Merge branch 'Merge_cleanup' into Development

2.0.x
Chris Roadfeldt 10 years ago
commit f53e951462

@ -330,7 +330,6 @@ const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
//#define DISABLE_MAX_ENDSTOPS //#define DISABLE_MAX_ENDSTOPS
//#define DISABLE_MIN_ENDSTOPS //#define DISABLE_MIN_ENDSTOPS
// If you want to enable the Z Probe pin, but disable its use, uncomment the line below. // If you want to enable the Z Probe pin, but disable its use, uncomment the line below.

@ -231,7 +231,6 @@ void refresh_cmd_timeout(void);
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
extern bool volumetric_enabled; extern bool volumetric_enabled;
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.

@ -170,7 +170,7 @@
// M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters // M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
// M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder // M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder
// M406 - Turn off Filament Sensor extrusion control // M406 - Turn off Filament Sensor extrusion control
// M407 - Displays measured filament diameter // M407 - Display measured filament diameter
// M500 - Store parameters in EEPROM // M500 - Store parameters in EEPROM
// M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily). // M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. // M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
@ -272,7 +272,7 @@ int fanSpeed = 0;
#endif // FWRETRACT #endif // FWRETRACT
#ifdef ULTIPANEL #if defined(ULTIPANEL) && HAS_POWER_SWITCH
bool powersupply = bool powersupply =
#ifdef PS_DEFAULT_OFF #ifdef PS_DEFAULT_OFF
false false
@ -311,13 +311,13 @@ bool cancel_heatup = false;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
//Variables for Filament Sensor input //Variables for Filament Sensor input
float filament_width_nominal=DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404 float filament_width_nominal = DEFAULT_NOMINAL_FILAMENT_DIA; //Set nominal filament width, can be changed with M404
bool filament_sensor=false; //M405 turns on filament_sensor control, M406 turns it off bool filament_sensor = false; //M405 turns on filament_sensor control, M406 turns it off
float filament_width_meas=DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter float filament_width_meas = DEFAULT_MEASURED_FILAMENT_DIA; //Stores the measured filament diameter
signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100 signed char measurement_delay[MAX_MEASUREMENT_DELAY+1]; //ring buffer to delay measurement store extruder factor after subtracting 100
int delay_index1=0; //index into ring buffer int delay_index1 = 0; //index into ring buffer
int delay_index2=-1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized int delay_index2 = -1; //index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
float delay_dist=0; //delay distance counter float delay_dist = 0; //delay distance counter
int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting int meas_delay_cm = MEASUREMENT_DELAY_CM; //distance delay setting
#endif #endif
@ -516,8 +516,8 @@ void setup_powerhold()
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
#if defined(PS_DEFAULT_OFF) #ifdef PS_DEFAULT_OFF
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else #else
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
@ -1250,7 +1250,7 @@ inline void sync_plan_position() {
if (z_probe_endstop) { if (z_probe_endstop) {
#else #else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (!z_min_endstop) { if (z_min_endstop) {
#endif #endif
if (!Stopped) { if (!Stopped) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
@ -1321,7 +1321,7 @@ inline void sync_plan_position() {
#if defined(Z_PROBE_ENDSTOP) #if defined(Z_PROBE_ENDSTOP)
bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING); bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
if (z_probe_endstop) { if (!z_probe_endstop) {
#else #else
bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
if (!z_min_endstop) { if (!z_min_endstop) {
@ -3319,7 +3319,7 @@ inline void gcode_M140() {
if (code_seen('S')) setTargetBed(code_value()); if (code_seen('S')) setTargetBed(code_value());
} }
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
/** /**
* M80: Turn on Power Supply * M80: Turn on Power Supply
@ -3341,10 +3341,12 @@ inline void gcode_M140() {
#endif #endif
} }
#endif // PS_ON_PIN #endif // HAS_POWER_SWITCH
/** /**
* M81: Turn off Power Supply * M81: Turn off Power, including Power Supply, if there is one.
*
* This code should ALWAYS be available for EMERGENCY SHUTDOWN!
*/ */
inline void gcode_M81() { inline void gcode_M81() {
disable_heater(); disable_heater();
@ -3359,16 +3361,19 @@ inline void gcode_M81() {
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize(); st_synchronize();
suicide(); suicide();
#elif defined(PS_ON_PIN) && PS_ON_PIN > -1 #elif HAS_POWER_SWITCH
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
#if HAS_POWER_SWITCH
powersupply = false; powersupply = false;
#endif
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
lcd_update(); lcd_update();
#endif #endif
} }
/** /**
* M82: Set E codes absolute (default) * M82: Set E codes absolute (default)
*/ */
@ -4903,15 +4908,15 @@ void process_commands() {
#endif //HEATER_2_PIN #endif //HEATER_2_PIN
#endif //BARICUDA #endif //BARICUDA
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
case 80: // M80 - Turn on Power Supply case 80: // M80 - Turn on Power Supply
gcode_M80(); gcode_M80();
break; break;
#endif // PS_ON_PIN #endif // HAS_POWER_SWITCH
case 81: // M81 - Turn off Power Supply case 81: // M81 - Turn off Power, including Power Supply, if possible
gcode_M81(); gcode_M81();
break; break;
@ -5882,19 +5887,17 @@ void kill()
disable_e2(); disable_e2();
disable_e3(); disable_e3();
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
pinMode(PS_ON_PIN,INPUT); pinMode(PS_ON_PIN, INPUT);
#endif #endif
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
LCD_ALERTMESSAGEPGM(MSG_KILLED); LCD_ALERTMESSAGEPGM(MSG_KILLED);
// FMC small patch to update the LCD before ending // FMC small patch to update the LCD before ending
sei(); // enable interrupts sei(); // enable interrupts
for ( int i=5; i--; lcd_update()) for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
{
delay(200);
}
cli(); // disable interrupts cli(); // disable interrupts
suicide(); suicide();
while(1) { /* Intentionally left empty */ } // Wait for reset while(1) { /* Intentionally left empty */ } // Wait for reset

@ -369,7 +369,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("dia:")); lcd_printPGM(PSTR("dia:"));
lcd_print(ftostr12ns(filament_width_meas)); lcd_print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR(" factor:")); lcd_printPGM(PSTR(" factor:"));
lcd_print(itostr3(extrudemultiply)); lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd_print('%'); lcd_print('%');
} }
#endif #endif

@ -545,7 +545,7 @@ float junction_deviation = 0.1;
block->steps[Z_AXIS] = labs(dz); block->steps[Z_AXIS] = labs(dz);
block->steps[E_AXIS] = labs(de); block->steps[E_AXIS] = labs(de);
block->steps[E_AXIS] *= volumetric_multiplier[active_extruder]; block->steps[E_AXIS] *= volumetric_multiplier[active_extruder];
block->steps[E_AXIS] *= extrudemultiply; block->steps[E_AXIS] *= extruder_multiply[active_extruder];
block->steps[E_AXIS] /= 100; block->steps[E_AXIS] /= 100;
block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS]))); block->step_event_count = max(block->steps[X_AXIS], max(block->steps[Y_AXIS], max(block->steps[Z_AXIS], block->steps[E_AXIS])));
@ -679,7 +679,7 @@ float junction_deviation = 0.1;
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS]; delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
#endif #endif
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS]; delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extrudemultiply / 100.0; delta_mm[E_AXIS] = (de / axis_steps_per_unit[E_AXIS]) * volumetric_multiplier[active_extruder] * extruder_multiply[active_extruder] / 100.0;
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) { if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
block->millimeters = fabs(delta_mm[E_AXIS]); block->millimeters = fabs(delta_mm[E_AXIS]);

@ -524,33 +524,43 @@ ISR(TIMER1_COMPA_vect) {
} }
if (TEST(out_bits, Z_AXIS)) { // -direction if (TEST(out_bits, Z_AXIS)) { // -direction
Z_APPLY_DIR(INVERT_Z_DIR,0); Z_APPLY_DIR(INVERT_Z_DIR,0);
count_direction[Z_AXIS] = -1; count_direction[Z_AXIS] = -1;
if (check_endstops)
{ if (check_endstops) {
#if defined(Z_MIN_PIN) && Z_MIN_PIN > -1
#ifndef Z_DUAL_ENDSTOPS #if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
UPDATE_ENDSTOP(z, Z, min, MIN);
#ifdef Z_DUAL_ENDSTOPS
bool z_min_endstop = READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING,
z2_min_endstop =
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING
#else #else
bool z_min_endstop=(READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); z_min_endstop
#if defined(Z2_MIN_PIN) && Z2_MIN_PIN > -1
bool z2_min_endstop=(READ(Z2_MIN_PIN) != Z2_MIN_ENDSTOP_INVERTING);
#else
bool z2_min_endstop=z_min_endstop;
#endif #endif
if(((z_min_endstop && old_z_min_endstop) || (z2_min_endstop && old_z2_min_endstop)) && (current_block->steps[Z_AXIS] > 0)) ;
{
bool z_min_both = z_min_endstop && old_z_min_endstop,
z2_min_both = z2_min_endstop && old_z2_min_endstop;
if ((z_min_both || z2_min_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit = true;
if (!(performing_homing) || ((performing_homing)&&(z_min_endstop && old_z_min_endstop)&&(z2_min_endstop && old_z2_min_endstop))) //if not performing home or if both endstops were trigged during homing... if (!performing_homing || (performing_homing && z_min_both && z2_min_both)) //if not performing home or if both endstops were trigged during homing...
{
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
} }
}
old_z_min_endstop = z_min_endstop; old_z_min_endstop = z_min_endstop;
old_z2_min_endstop = z2_min_endstop; old_z2_min_endstop = z2_min_endstop;
#endif
#endif #else // !Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, min, MIN);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MIN_PIN
#ifdef Z_PROBE_ENDSTOP #ifdef Z_PROBE_ENDSTOP
UPDATE_ENDSTOP(z, Z, probe, PROBE); UPDATE_ENDSTOP(z, Z, probe, PROBE);
@ -564,40 +574,52 @@ ISR(TIMER1_COMPA_vect) {
} }
old_z_probe_endstop = z_probe_endstop; old_z_probe_endstop = z_probe_endstop;
#endif #endif
}
} // check_endstops
} }
else { // +direction else { // +direction
Z_APPLY_DIR(!INVERT_Z_DIR,0); Z_APPLY_DIR(!INVERT_Z_DIR,0);
count_direction[Z_AXIS] = 1; count_direction[Z_AXIS] = 1;
if (check_endstops) { if (check_endstops) {
#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0 #if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
#ifndef Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, max, MAX); #ifdef Z_DUAL_ENDSTOPS
bool z_max_endstop = READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING,
z2_max_endstop =
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING
#else #else
bool z_max_endstop=(READ(Z_MAX_PIN) != Z_MAX_ENDSTOP_INVERTING); z_max_endstop
#if defined(Z2_MAX_PIN) && Z2_MAX_PIN > -1
bool z2_max_endstop=(READ(Z2_MAX_PIN) != Z2_MAX_ENDSTOP_INVERTING);
#else
bool z2_max_endstop=z_max_endstop;
#endif #endif
if(((z_max_endstop && old_z_max_endstop) || (z2_max_endstop && old_z2_max_endstop)) && (current_block->steps[Z_AXIS] > 0)) ;
{
bool z_max_both = z_max_endstop && old_z_max_endstop,
z2_max_both = z2_max_endstop && old_z2_max_endstop;
if ((z_max_both || z2_max_both) && current_block->steps[Z_AXIS] > 0) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit=true; endstop_z_hit = true;
// if (z_max_endstop && old_z_max_endstop) SERIAL_ECHOLN("z_max_endstop = true"); // if (z_max_both) SERIAL_ECHOLN("z_max_endstop = true");
// if (z2_max_endstop && old_z2_max_endstop) SERIAL_ECHOLN("z2_max_endstop = true"); // if (z2_max_both) SERIAL_ECHOLN("z2_max_endstop = true");
if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
if (!(performing_homing) || ((performing_homing)&&(z_max_endstop && old_z_max_endstop)&&(z2_max_endstop && old_z2_max_endstop))) //if not performing home or if both endstops were trigged during homing...
{
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
} }
}
old_z_max_endstop = z_max_endstop; old_z_max_endstop = z_max_endstop;
old_z2_max_endstop = z2_max_endstop; old_z2_max_endstop = z2_max_endstop;
#endif
#endif #else // !Z_DUAL_ENDSTOPS
UPDATE_ENDSTOP(z, Z, max, MAX);
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MAX_PIN
#ifdef Z_PROBE_ENDSTOP #ifdef Z_PROBE_ENDSTOP
UPDATE_ENDSTOP(z, Z, probe, PROBE); UPDATE_ENDSTOP(z, Z, probe, PROBE);
@ -610,22 +632,24 @@ ISR(TIMER1_COMPA_vect) {
} }
old_z_probe_endstop = z_probe_endstop; old_z_probe_endstop = z_probe_endstop;
#endif #endif
}
} } // check_endstops
} // +direction
#ifndef ADVANCE #ifndef ADVANCE
if (TEST(out_bits, E_AXIS)) { // -direction if (TEST(out_bits, E_AXIS)) { // -direction
REV_E_DIR(); REV_E_DIR();
count_direction[E_AXIS]=-1; count_direction[E_AXIS] = -1;
} }
else { // +direction else { // +direction
NORM_E_DIR(); NORM_E_DIR();
count_direction[E_AXIS]=1; count_direction[E_AXIS] = 1;
} }
#endif //!ADVANCE #endif //!ADVANCE
// Take multiple steps per interrupt (For high speed moves) // Take multiple steps per interrupt (For high speed moves)
for (int8_t i=0; i < step_loops; i++) { for (int8_t i = 0; i < step_loops; i++) {
#ifndef AT90USB #ifndef AT90USB
MSerial.checkRx(); // Check for serial chars. MSerial.checkRx(); // Check for serial chars.
#endif #endif

@ -491,7 +491,7 @@ static void lcd_tune_menu() {
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif #endif
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW, &extruder_multiply[active_extruder], 10, 999);
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
#if TEMP_SENSOR_1 != 0 #if TEMP_SENSOR_1 != 0
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999);

@ -624,7 +624,7 @@ static void lcd_implementation_status_screen()
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
char c; char c;
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2); uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row); lcd.setCursor(0, row);
lcd.print(sel ? pre_char : ' '); lcd.print(sel ? pre_char : ' ');
while ((c = pgm_read_byte(pstr)) && n > 0) { while ((c = pgm_read_byte(pstr)) && n > 0) {
@ -633,12 +633,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha
} }
while(n--) lcd.print(' '); while(n--) lcd.print(' ');
lcd.print(post_char); lcd.print(post_char);
lcd.print(' ');
} }
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) { static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
char c; char c;
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data); uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
lcd.setCursor(0, row); lcd.setCursor(0, row);
lcd.print(sel ? pre_char : ' '); lcd.print(sel ? pre_char : ' ');
while ((c = pgm_read_byte(pstr)) && n > 0) { while ((c = pgm_read_byte(pstr)) && n > 0) {
@ -651,7 +650,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t r
} }
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) { static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) {
char c; char c;
uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data); uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
lcd.setCursor(0, row); lcd.setCursor(0, row);
lcd.print(sel ? pre_char : ' '); lcd.print(sel ? pre_char : ' ');
while ((c = pgm_read_byte(pstr)) && n > 0) { while ((c = pgm_read_byte(pstr)) && n > 0) {
@ -688,11 +687,11 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
lcd.setCursor(1, 1); lcd.setCursor(1, 1);
lcd_printPGM(pstr); lcd_printPGM(pstr);
lcd.print(':'); lcd.print(':');
lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1); lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
lcd_print(value); lcd_print(value);
} }
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) { static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
char c; char c;
uint8_t n = LCD_WIDTH - concat; uint8_t n = LCD_WIDTH - concat;
lcd.setCursor(0, row); lcd.setCursor(0, row);
@ -706,14 +705,15 @@ static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* ps
filename++; filename++;
} }
while (n--) lcd.print(' '); while (n--) lcd.print(' ');
lcd.print(post_char);
} }
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1); lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
} }
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2); lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
} }
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) #define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])

Loading…
Cancel
Save