|
@@ -40,6 +40,7 @@
|
|
|
|
|
|
#include "static_assert.h"
|
|
|
#include "io_atmega2560.h"
|
|
|
+#include "first_lay_cal.h"
|
|
|
|
|
|
|
|
|
int scrollstuff = 0;
|
|
@@ -74,7 +75,7 @@ bool presort_flag = false;
|
|
|
#endif
|
|
|
|
|
|
LcdCommands lcd_commands_type = LcdCommands::IDLE;
|
|
|
-uint8_t lcd_commands_step = 0;
|
|
|
+static uint8_t lcd_commands_step = 0;
|
|
|
|
|
|
CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS;
|
|
|
unsigned int custom_message_state = 0;
|
|
@@ -245,7 +246,6 @@ static char snmm_stop_print_menu();
|
|
|
#ifdef SDCARD_SORT_ALPHA
|
|
|
static void lcd_sort_type_set();
|
|
|
#endif
|
|
|
-static float count_e(float layer_heigth, float extrusion_width, float extrusion_length);
|
|
|
static void lcd_babystep_z();
|
|
|
static void lcd_send_status();
|
|
|
#ifdef FARM_CONNECT_MESSAGE
|
|
@@ -317,7 +317,7 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longF
|
|
|
char c;
|
|
|
int enc_dif = lcd_encoder_diff;
|
|
|
uint8_t n = LCD_WIDTH - 1;
|
|
|
- for(int g = 0; g<4;g++){
|
|
|
+ for(uint_least8_t g = 0; g<4;g++){
|
|
|
lcd_set_cursor(0, g);
|
|
|
lcd_print(' ');
|
|
|
}
|
|
@@ -1060,21 +1060,6 @@ static void lcd_status_screen()
|
|
|
feedmultiply = 999;
|
|
|
}
|
|
|
|
|
|
-//! extracted common code from lcd_commands into a separate function
|
|
|
-//! along with the sprintf_P optimization this change gained more than 1.6KB
|
|
|
-static void lcd_commands_func1(char *cmd1, uint8_t i, float width, float extr, float extr_short_segment){
|
|
|
- static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f";
|
|
|
- static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f";
|
|
|
- sprintf_P(cmd1, fmt1, 70, (35 - i*width * 2), extr);
|
|
|
- enquecommand(cmd1);
|
|
|
- sprintf_P(cmd1, fmt2, (35 - (2 * i + 1)*width), extr_short_segment);
|
|
|
- enquecommand(cmd1);
|
|
|
- sprintf_P(cmd1, fmt1, 50, (35 - (2 * i + 1)*width), extr);
|
|
|
- enquecommand(cmd1);
|
|
|
- sprintf_P(cmd1, fmt2, (35 - (i + 1)*width * 2), extr_short_segment);
|
|
|
- enquecommand(cmd1);
|
|
|
-}
|
|
|
-
|
|
|
void lcd_commands()
|
|
|
{
|
|
|
if (lcd_commands_type == LcdCommands::LONG_PAUSE)
|
|
@@ -1362,215 +1347,106 @@ void lcd_commands()
|
|
|
{
|
|
|
char cmd1[30];
|
|
|
static uint8_t filament = 0;
|
|
|
- float width = 0.4;
|
|
|
- float length = 20 - width;
|
|
|
- float extr = count_e(0.2, width, length);
|
|
|
- float extr_short_segment = count_e(0.2, width, width);
|
|
|
- if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
|
|
-
|
|
|
- if (lcd_commands_step == 0 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 20 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- filament = 0;
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 21 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- filament = 1;
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 22 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- filament = 2;
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 23 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- filament = 3;
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 24 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- filament = 4;
|
|
|
- lcd_commands_step = 10;
|
|
|
- }
|
|
|
|
|
|
- if (lcd_commands_step == 10)
|
|
|
- {
|
|
|
- enquecommand_P(PSTR("M107"));
|
|
|
- enquecommand_P(PSTR("M104 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)));
|
|
|
- enquecommand_P(PSTR("M140 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP)));
|
|
|
- enquecommand_P(PSTR("M190 S" STRINGIFY(PLA_PREHEAT_HPB_TEMP)));
|
|
|
- enquecommand_P(PSTR("M109 S" STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)));
|
|
|
- enquecommand_P(_T(MSG_M117_V2_CALIBRATION));
|
|
|
- enquecommand_P(PSTR("G28"));
|
|
|
- enquecommand_P(PSTR("G92 E0.0"));
|
|
|
+ if(lcd_commands_step>1) lcd_timeoutToStatus.start(); //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
|
|
|
|
|
- lcd_commands_step = 9;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 9 && !blocks_queued() && cmd_buffer_empty())
|
|
|
+ if (!blocks_queued() && cmd_buffer_empty())
|
|
|
{
|
|
|
- lcd_clear();
|
|
|
- menu_depth = 0;
|
|
|
- menu_submenu(lcd_babystep_z);
|
|
|
-
|
|
|
- if (mmu_enabled)
|
|
|
+ switch(lcd_commands_step)
|
|
|
{
|
|
|
- enquecommand_P(PSTR("M83")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 Y-3.0 F1000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 Z0.4 F1000.0")); //intro line
|
|
|
- strcpy(cmd1, "T");
|
|
|
- strcat(cmd1, itostr3left(filament));
|
|
|
- enquecommand(cmd1);
|
|
|
- enquecommand_P(PSTR("G1 X55.0 E32.0 F1073.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X5.0 E32.0 F1800.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X55.0 E8.0 F2000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 Z0.3 F1000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G92 E0.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X240.0 E25.0 F2200.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 Y-2.0 F1000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X55.0 E25 F1400.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 Z0.20 F1000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X5.0 E4.0 F1000.0")); //intro line
|
|
|
-
|
|
|
- } else
|
|
|
- {
|
|
|
- enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0")); //intro line
|
|
|
- enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0")); //intro line
|
|
|
+ case 0:
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 20:
|
|
|
+ filament = 0;
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 21:
|
|
|
+ filament = 1;
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 22:
|
|
|
+ filament = 2;
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 23:
|
|
|
+ filament = 3;
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 24:
|
|
|
+ filament = 4;
|
|
|
+ lcd_commands_step = 10;
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ lay1cal_preheat();
|
|
|
+ lcd_commands_step = 9;
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ lcd_clear();
|
|
|
+ menu_depth = 0;
|
|
|
+ menu_submenu(lcd_babystep_z);
|
|
|
+ lay1cal_intro_line(cmd1, filament);
|
|
|
+ lcd_commands_step = 8;
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ lay1cal_before_meander();
|
|
|
+ lcd_commands_step = 7;
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ lay1cal_meander(cmd1);
|
|
|
+ lcd_commands_step = 6;
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ for (uint8_t i = 0; i < 4; i++)
|
|
|
+ {
|
|
|
+ lay1cal_square(cmd1, i);
|
|
|
+ }
|
|
|
+ lcd_commands_step = 5;
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ for (uint8_t i = 4; i < 8; i++)
|
|
|
+ {
|
|
|
+ lay1cal_square(cmd1, i);
|
|
|
+ }
|
|
|
+ lcd_commands_step = 4;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ for (uint8_t i = 8; i < 12; i++)
|
|
|
+ {
|
|
|
+ lay1cal_square(cmd1, i);
|
|
|
+ }
|
|
|
+ lcd_commands_step = 3;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ for (uint8_t i = 12; i < 16; i++)
|
|
|
+ {
|
|
|
+ lay1cal_square(cmd1, i);
|
|
|
+ }
|
|
|
+ lcd_commands_step = 2;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ enquecommand_P(PSTR("M107")); //turn off printer fan
|
|
|
+ enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract
|
|
|
+ enquecommand_P(PSTR("M104 S0")); // turn off temperature
|
|
|
+ enquecommand_P(PSTR("M140 S0")); // turn off heatbed
|
|
|
+ enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z
|
|
|
+ enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
|
|
|
+ if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle
|
|
|
+ enquecommand_P(PSTR("M84"));// disable motors
|
|
|
+ forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
|
|
+ lcd_commands_step = 1;
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
+ lcd_commands_step = 0;
|
|
|
+ lcd_commands_type = LcdCommands::IDLE;
|
|
|
+ if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1)
|
|
|
+ {
|
|
|
+ lcd_wizard(WizState::RepeatLay1Cal);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
- lcd_commands_step = 8;
|
|
|
}
|
|
|
- if (lcd_commands_step == 8 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
-
|
|
|
- enquecommand_P(PSTR("G92 E0.0"));
|
|
|
- enquecommand_P(PSTR("G21")); //set units to millimeters
|
|
|
- enquecommand_P(PSTR("G90")); //use absolute coordinates
|
|
|
- enquecommand_P(PSTR("M83")); //use relative distances for extrusion
|
|
|
- enquecommand_P(PSTR("G1 E-1.50000 F2100.00000"));
|
|
|
- enquecommand_P(PSTR("G1 Z5 F7200.000"));
|
|
|
- enquecommand_P(PSTR("M204 S1000")); //set acceleration
|
|
|
- enquecommand_P(PSTR("G1 F4000"));
|
|
|
- lcd_commands_step = 7;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 7 && !blocks_queued() && cmd_buffer_empty()) //draw meander
|
|
|
- {
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
-
|
|
|
-
|
|
|
- //just opposite direction
|
|
|
- /*enquecommand_P(PSTR("G1 X50 Y55"));
|
|
|
- enquecommand_P(PSTR("G1 F1080"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y55 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y75 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y75 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y95 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y95 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y115 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y115 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y135 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y135 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y155 E0.66174"));
|
|
|
- enquecommand_P(PSTR("G1 X100 Y155 E2.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X75 Y155 E2"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y155 E2.5"));
|
|
|
- enquecommand_P(PSTR("G1 E - 0.07500 F2100.00000"));*/
|
|
|
-
|
|
|
-
|
|
|
- enquecommand_P(PSTR("G1 X50 Y155"));
|
|
|
- enquecommand_P(PSTR("G1 Z0.150 F7200.000"));
|
|
|
- enquecommand_P(PSTR("G1 F1080"));
|
|
|
- enquecommand_P(PSTR("G1 X75 Y155 E2.5"));
|
|
|
- enquecommand_P(PSTR("G1 X100 Y155 E2"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y155 E2.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y135 E0.66174"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y135 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y115 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y115 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y95 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y95 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y75 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y75 E3.62773"));
|
|
|
- enquecommand_P(PSTR("G1 X200 Y55 E0.49386"));
|
|
|
- enquecommand_P(PSTR("G1 X50 Y55 E3.62773"));
|
|
|
-
|
|
|
- strcpy(cmd1, "G1 X50 Y35 E");
|
|
|
- strcat(cmd1, ftostr43(extr));
|
|
|
- enquecommand(cmd1);
|
|
|
-
|
|
|
- lcd_commands_step = 6;
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_commands_step == 6 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
-
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
-
|
|
|
- for (uint8_t i = 0; i < 4; i++) {
|
|
|
- lcd_commands_func1(cmd1, i, width, extr, extr_short_segment );
|
|
|
- }
|
|
|
-
|
|
|
- lcd_commands_step = 5;
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_commands_step == 5 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
- for (uint8_t i = 4; i < 8; i++) {
|
|
|
- lcd_commands_func1(cmd1, i, width, extr, extr_short_segment );
|
|
|
- }
|
|
|
-
|
|
|
- lcd_commands_step = 4;
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_commands_step == 4 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
- for (uint8_t i = 8; i < 12; i++) {
|
|
|
- lcd_commands_func1(cmd1, i, width, extr, extr_short_segment );
|
|
|
- }
|
|
|
-
|
|
|
- lcd_commands_step = 3;
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_commands_step == 3 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
- for (uint8_t i = 12; i < 16; i++) {
|
|
|
- lcd_commands_func1(cmd1, i, width, extr, extr_short_segment );
|
|
|
- }
|
|
|
-
|
|
|
- lcd_commands_step = 2;
|
|
|
- }
|
|
|
-
|
|
|
- if (lcd_commands_step == 2 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_timeoutToStatus.start();
|
|
|
- enquecommand_P(PSTR("M107")); //turn off printer fan
|
|
|
- enquecommand_P(PSTR("G1 E-0.07500 F2100.00000")); //retract
|
|
|
- enquecommand_P(PSTR("M104 S0")); // turn off temperature
|
|
|
- enquecommand_P(PSTR("M140 S0")); // turn off heatbed
|
|
|
- enquecommand_P(PSTR("G1 Z10 F1300.000")); //lift Z
|
|
|
- enquecommand_P(PSTR("G1 X10 Y180 F4000")); //Go to parking position
|
|
|
- if (mmu_enabled) enquecommand_P(PSTR("M702 C")); //unload from nozzle
|
|
|
- enquecommand_P(PSTR("M84"));// disable motors
|
|
|
- forceMenuExpire = true; //if user dont confirm live adjust Z value by pressing the knob, we are saving last value by timeout to status screen
|
|
|
- lcd_commands_step = 1;
|
|
|
- }
|
|
|
- if (lcd_commands_step == 1 && !blocks_queued() && cmd_buffer_empty())
|
|
|
- {
|
|
|
- lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
- lcd_commands_step = 0;
|
|
|
- lcd_commands_type = LcdCommands::IDLE;
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
|
|
|
- lcd_wizard(WizState::RepeatLay1Cal);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#endif // not SNMM
|
|
@@ -1764,12 +1640,6 @@ void lcd_commands()
|
|
|
|
|
|
}
|
|
|
|
|
|
-static float count_e(float layer_heigth, float extrusion_width, float extrusion_length) {
|
|
|
- //returns filament length in mm which needs to be extrude to form line with extrusion_length * extrusion_width * layer heigth dimensions
|
|
|
- float extr = extrusion_length * layer_heigth * extrusion_width / (M_PI * pow(1.75, 2) / 4);
|
|
|
- return extr;
|
|
|
-}
|
|
|
-
|
|
|
void lcd_return_to_status()
|
|
|
{
|
|
|
lcd_refresh(); // to maybe revive the LCD if static electricity killed it.
|
|
@@ -2708,11 +2578,11 @@ void lcd_change_success() {
|
|
|
|
|
|
static void lcd_loading_progress_bar(uint16_t loading_time_ms) {
|
|
|
|
|
|
- for (int i = 0; i < 20; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < 20; i++) {
|
|
|
lcd_set_cursor(i, 3);
|
|
|
lcd_print(".");
|
|
|
//loading_time_ms/20 delay
|
|
|
- for (int j = 0; j < 5; j++) {
|
|
|
+ for (uint_least8_t j = 0; j < 5; j++) {
|
|
|
delay_keep_alive(loading_time_ms / 100);
|
|
|
}
|
|
|
}
|
|
@@ -3154,7 +3024,7 @@ static void lcd_menu_xyz_offset()
|
|
|
float cntr[2];
|
|
|
world2machine_read_valid(vec_x, vec_y, cntr);
|
|
|
|
|
|
- for (int i = 0; i < 2; i++)
|
|
|
+ for (uint_least8_t i = 0; i < 2; i++)
|
|
|
{
|
|
|
lcd_puts_at_P(11, i + 2, PSTR(""));
|
|
|
lcd_print(cntr[i]);
|
|
@@ -4822,7 +4692,7 @@ void lcd_v2_calibration()
|
|
|
else {
|
|
|
lcd_display_message_fullscreen_P(_i("Please load PLA filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4
|
|
|
lcd_consume_click();
|
|
|
- for (int i = 0; i < 20; i++) { //wait max. 2s
|
|
|
+ for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s
|
|
|
delay_keep_alive(100);
|
|
|
if (lcd_clicked()) {
|
|
|
break;
|
|
@@ -5549,7 +5419,7 @@ void bowden_menu() {
|
|
|
lcd_clear();
|
|
|
lcd_set_cursor(0, 0);
|
|
|
lcd_print(">");
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < 4; i++) {
|
|
|
lcd_set_cursor(1, i);
|
|
|
lcd_print("Extruder ");
|
|
|
lcd_print(i);
|
|
@@ -5637,7 +5507,7 @@ void bowden_menu() {
|
|
|
enc_dif = lcd_encoder_diff;
|
|
|
lcd_set_cursor(0, cursor_pos);
|
|
|
lcd_print(">");
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < 4; i++) {
|
|
|
lcd_set_cursor(1, i);
|
|
|
lcd_print("Extruder ");
|
|
|
lcd_print(i);
|
|
@@ -5764,14 +5634,14 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite
|
|
|
if (header) lcd_puts_at_P(0,0,header);
|
|
|
|
|
|
const bool last_visible = (first == items_no - 3);
|
|
|
- const int8_t ordinary_items = (last_item&&last_visible)?2:3;
|
|
|
+ const uint_least8_t ordinary_items = (last_item&&last_visible)?2:3;
|
|
|
|
|
|
- for (int i = 0; i < ordinary_items; i++)
|
|
|
+ for (uint_least8_t i = 0; i < ordinary_items; i++)
|
|
|
{
|
|
|
if (item) lcd_puts_at_P(1, i + 1, item);
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < ordinary_items; i++)
|
|
|
+ for (uint_least8_t i = 0; i < ordinary_items; i++)
|
|
|
{
|
|
|
lcd_set_cursor(2 + item_len, i+1);
|
|
|
lcd_print(first + i + 1);
|
|
@@ -5825,7 +5695,7 @@ char reset_menu() {
|
|
|
lcd_consume_click();
|
|
|
while (1) {
|
|
|
|
|
|
- for (int i = 0; i < 4; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < 4; i++) {
|
|
|
lcd_set_cursor(1, i);
|
|
|
lcd_print(item[first + i]);
|
|
|
}
|
|
@@ -6151,7 +6021,7 @@ unsigned char lcd_choose_color() {
|
|
|
item[0] = "Orange";
|
|
|
item[1] = "Black";
|
|
|
//-----------------------------------------------------
|
|
|
- unsigned char active_rows;
|
|
|
+ uint_least8_t active_rows;
|
|
|
static int first = 0;
|
|
|
int enc_dif = 0;
|
|
|
unsigned char cursor_pos = 1;
|
|
@@ -6164,7 +6034,7 @@ unsigned char lcd_choose_color() {
|
|
|
lcd_consume_click();
|
|
|
while (1) {
|
|
|
lcd_puts_at_P(0, 0, PSTR("Choose color:"));
|
|
|
- for (int i = 0; i < active_rows; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < active_rows; i++) {
|
|
|
lcd_set_cursor(1, i+1);
|
|
|
lcd_print(item[first + i]);
|
|
|
}
|
|
@@ -7201,7 +7071,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|
|
|
|
|
//end of second measurement, now check for possible errors:
|
|
|
|
|
|
- for(int i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length
|
|
|
+ for(uint_least8_t i = 0; i < 2; i++){ //check if measured axis length corresponds to expected length
|
|
|
printf_P(_N("Measured axis length:%.3f\n"), measured_axis_length[i]);
|
|
|
if (abs(measured_axis_length[i] - axis_length) > max_error_mm) {
|
|
|
enable_endstops(false);
|
|
@@ -8065,7 +7935,7 @@ static void menu_action_sdfile(const char* filename)
|
|
|
const char end[5] = ".gco";
|
|
|
|
|
|
//we are storing just first 8 characters of 8.3 filename assuming that extension is always ".gco"
|
|
|
- for (int i = 0; i < 8; i++) {
|
|
|
+ for (uint_least8_t i = 0; i < 8; i++) {
|
|
|
if (strcmp((cmd + i + 4), end) == 0) {
|
|
|
//filename is shorter then 8.3, store '\0' character on position where ".gco" string was found to terminate stored string properly
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, '\0');
|
|
@@ -8079,8 +7949,8 @@ static void menu_action_sdfile(const char* filename)
|
|
|
uint8_t depth = (uint8_t)card.getWorkDirDepth();
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
|
|
|
|
|
|
- for (uint8_t i = 0; i < depth; i++) {
|
|
|
- for (int j = 0; j < 8; j++) {
|
|
|
+ for (uint_least8_t i = 0; i < depth; i++) {
|
|
|
+ for (uint_least8_t j = 0; j < 8; j++) {
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
|
|
|
}
|
|
|
}
|