More MKS UI prelim. cleanup

This commit is contained in:
Scott Lahteine 2021-01-14 00:23:56 -06:00 committed by Scott Lahteine
parent a3d6442d02
commit 86bf374fc4
97 changed files with 203 additions and 300 deletions

View File

@ -84,7 +84,6 @@ class TFT_FSMC {
} }
}; };
#ifdef STM32F1xx #ifdef STM32F1xx
#define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE) #define FSMC_PIN_DATA STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, AFIO_NONE)
#elif defined(STM32F4xx) #elif defined(STM32F4xx)

View File

@ -44,7 +44,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_about(void) { void lv_draw_about() {
scr = lv_screen_create(ABOUT_UI); scr = lv_screen_create(ABOUT_UI);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN); lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_about(void); extern void lv_draw_about();
extern void lv_clear_about(); extern void lv_clear_about();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -107,7 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_acceleration_settings(void) { void lv_draw_acceleration_settings() {
scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle); scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle);
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_acceleration_settings(void); extern void lv_draw_acceleration_settings();
extern void lv_clear_acceleration_settings(); extern void lv_clear_acceleration_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -69,7 +69,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_advance_settings(void) { void lv_draw_advance_settings() {
scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle); scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle);
int index = 0; int index = 0;

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_advance_settings(void); extern void lv_draw_advance_settings();
extern void lv_clear_advance_settings(); extern void lv_clear_advance_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -64,7 +64,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_auto_level_offset_settings(void) { void lv_draw_auto_level_offset_settings() {
scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle); scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle);
sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0)); sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0));

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_auto_level_offset_settings(void); extern void lv_draw_auto_level_offset_settings();
extern void lv_clear_auto_level_offset_settings(); extern void lv_clear_auto_level_offset_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -111,7 +111,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_baby_stepping(void) { void lv_draw_baby_stepping() {
scr = lv_screen_create(BABY_STEP_UI); scr = lv_screen_create(BABY_STEP_UI);
lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P); lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P);
lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N); lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_baby_stepping(void); extern void lv_draw_baby_stepping();
extern void lv_clear_baby_stepping(); extern void lv_clear_baby_stepping();
extern void disp_baby_step_dist(); extern void disp_baby_step_dist();
extern void disp_z_offset_value(); extern void disp_z_offset_value();

View File

@ -115,7 +115,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_change_speed(void) { void lv_draw_change_speed() {
scr = lv_screen_create(CHANGE_SPEED_UI); scr = lv_screen_create(CHANGE_SPEED_UI);
// Create an Image button // Create an Image button
lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD); lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD);

View File

@ -28,7 +28,7 @@
#define MIN_EXT_SPEED_PERCENT 10 #define MIN_EXT_SPEED_PERCENT 10
#define MAX_EXT_SPEED_PERCENT 999 #define MAX_EXT_SPEED_PERCENT 999
extern void lv_draw_change_speed(void); extern void lv_draw_change_speed();
extern void lv_clear_change_speed(); extern void lv_clear_change_speed();
extern void disp_speed_step(); extern void disp_speed_step();
extern void disp_print_speed(); extern void disp_print_speed();

View File

@ -60,7 +60,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
} }
void lv_draw_cloud_bind(void) { void lv_draw_cloud_bind() {
lv_obj_t *buttonBack = NULL, *label_Back = NULL; lv_obj_t *buttonBack = NULL, *label_Back = NULL;
scr = lv_screen_create(BIND_UI); scr = lv_screen_create(BIND_UI);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_cloud_bind(void); extern void lv_draw_cloud_bind();
extern void lv_clear_cloud_bind(); extern void lv_clear_cloud_bind();
extern void disp_bind_state(); extern void disp_bind_state();
extern void refresh_bind_ui(); extern void refresh_bind_ui();

View File

@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_eeprom_settings(void) { void lv_draw_eeprom_settings() {
scr = lv_screen_create(EEPROM_SETTINGS_UI); scr = lv_screen_create(EEPROM_SETTINGS_UI);
lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0); lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0);
lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1); lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_eeprom_settings(void); extern void lv_draw_eeprom_settings();
extern void lv_clear_eeprom_settings(); extern void lv_clear_eeprom_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_encoder_settings(void) { void lv_draw_encoder_settings() {
scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle); scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle);
buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable); buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_encoder_settings(void); extern void lv_draw_encoder_settings();
extern void lv_clear_encoder_settings(); extern void lv_clear_encoder_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -117,7 +117,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_extrusion(void) { void lv_draw_extrusion() {
scr = lv_screen_create(EXTRUSION_UI); scr = lv_screen_create(EXTRUSION_UI);
// Create image buttons // Create image buttons
lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD); lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_extrusion(void); extern void lv_draw_extrusion();
extern void lv_clear_extrusion(); extern void lv_clear_extrusion();
extern void disp_ext_type(); extern void disp_ext_type();
extern void disp_ext_step(); extern void disp_ext_step();

View File

@ -74,7 +74,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
gcode.process_subcommands_now(public_buf_l); gcode.process_subcommands_now(public_buf_l);
} }
void lv_draw_fan(void) { void lv_draw_fan() {
lv_obj_t *buttonAdd; lv_obj_t *buttonAdd;
#if HAS_FAN #if HAS_FAN

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_fan(void); extern void lv_draw_fan();
extern void lv_clear_fan(); extern void lv_clear_fan();
extern void disp_fan_value(); extern void disp_fan_value();

View File

@ -105,7 +105,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_filament_change(void) { void lv_draw_filament_change() {
scr = lv_screen_create(FILAMENTCHANGE_UI); scr = lv_screen_create(FILAMENTCHANGE_UI);
// Create an Image button // Create an Image button
lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN); lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_filament_change(void); extern void lv_draw_filament_change();
extern void lv_clear_filament_change(); extern void lv_clear_filament_change();
extern void disp_filament_type(); extern void disp_filament_type();
extern void disp_filament_temp(); extern void disp_filament_temp();

View File

@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_filament_settings(void) { void lv_draw_filament_settings() {
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle); scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_filament_settings(void); extern void lv_draw_filament_settings();
extern void lv_clear_filament_settings(); extern void lv_clear_filament_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -72,7 +72,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_home(void) { void lv_draw_home() {
scr = lv_screen_create(ZERO_UI); scr = lv_screen_create(ZERO_UI);
lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL); lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL);
lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X); lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_home(void); extern void lv_draw_home();
extern void lv_clear_home(); extern void lv_clear_home();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -74,7 +74,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_homing_sensitivity_settings(void) { void lv_draw_homing_sensitivity_settings() {
scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle); scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);
sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0)); sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_homing_sensitivity_settings(void); extern void lv_draw_homing_sensitivity_settings();
extern void lv_clear_homing_sensitivity_settings(); extern void lv_clear_homing_sensitivity_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -70,7 +70,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_jerk_settings(void) { void lv_draw_jerk_settings() {
scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle); scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]); sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_jerk_settings(void); extern void lv_draw_jerk_settings();
extern void lv_clear_jerk_settings(); extern void lv_clear_jerk_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -183,7 +183,7 @@ static void disp_language(uint8_t language, uint8_t state) {
if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj); if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj);
} }
void lv_draw_language(void) { void lv_draw_language() {
scr = lv_screen_create(LANGUAGE_UI); scr = lv_screen_create(LANGUAGE_UI);
// Create image buttons // Create image buttons
buttonCN = lv_big_button_create(scr, "F:/bmp_simplified_cn.bin", language_menu.chinese_s, INTERVAL_V, titleHeight, event_handler, ID_CN); buttonCN = lv_big_button_create(scr, "F:/bmp_simplified_cn.bin", language_menu.chinese_s, INTERVAL_V, titleHeight, event_handler, ID_CN);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_language(void); extern void lv_draw_language();
extern void lv_clear_language(); extern void lv_clear_language();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -60,7 +60,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_level_settings(void) { void lv_draw_level_settings() {
scr = lv_screen_create(LEVELING_PARA_UI, machine_menu.LevelingParaConfTitle); scr = lv_screen_create(LEVELING_PARA_UI, machine_menu.LevelingParaConfTitle);
lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0); lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0);
lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1); lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_level_settings(void); extern void lv_draw_level_settings();
extern void lv_clear_level_settings(); extern void lv_clear_level_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_machine_para(void) { void lv_draw_machine_para() {
scr = lv_screen_create(MACHINE_PARA_UI); scr = lv_screen_create(MACHINE_PARA_UI);
lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0); lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0);
lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1); lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_machine_para(void); extern void lv_draw_machine_para();
extern void lv_clear_machine_para(); extern void lv_clear_machine_para();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -62,7 +62,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_machine_settings(void) { void lv_draw_machine_settings() {
scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle); scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle);
lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0); lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0);
lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1); lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_machine_settings(void); extern void lv_draw_machine_settings();
extern void lv_clear_machine_settings(); extern void lv_clear_machine_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -113,7 +113,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_manualLevel(void) { void lv_draw_manualLevel() {
scr = lv_screen_create(LEVELING_UI); scr = lv_screen_create(LEVELING_UI);
// Create an Image button // Create an Image button
lv_obj_t *buttonPoint1 = lv_big_button_create(scr, "F:/bmp_leveling1.bin", leveling_menu.position1, INTERVAL_V, titleHeight, event_handler, ID_M_POINT1); lv_obj_t *buttonPoint1 = lv_big_button_create(scr, "F:/bmp_leveling1.bin", leveling_menu.position1, INTERVAL_V, titleHeight, event_handler, ID_M_POINT1);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_manualLevel(void); extern void lv_draw_manualLevel();
extern void lv_clear_manualLevel(); extern void lv_clear_manualLevel();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -101,7 +101,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
} }
void lv_draw_manual_level_pos_settings(void) { void lv_draw_manual_level_pos_settings() {
char buf2[50]; char buf2[50];
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle); scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_manual_level_pos_settings(void); extern void lv_draw_manual_level_pos_settings();
extern void lv_clear_manual_level_pos_settings(); extern void lv_clear_manual_level_pos_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -79,7 +79,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
} }
void lv_draw_max_feedrate_settings(void) { void lv_draw_max_feedrate_settings() {
scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle); scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle);
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_max_feedrate_settings(void); extern void lv_draw_max_feedrate_settings();
extern void lv_clear_max_feedrate_settings(); extern void lv_clear_max_feedrate_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -33,53 +33,28 @@
extern lv_group_t * g; extern lv_group_t * g;
static lv_obj_t * scr; static lv_obj_t * scr;
#define ID_CUSTOM_1 1 enum {
#define ID_CUSTOM_2 2 ID_GCODE = 1,
#define ID_CUSTOM_3 3 ID_CUSTOM_1,
#define ID_CUSTOM_4 4 ID_CUSTOM_2,
#define ID_CUSTOM_5 5 ID_CUSTOM_3,
#define ID_CUSTOM_6 6 ID_CUSTOM_4,
#define ID_CUSTOM_7 7 ID_CUSTOM_5,
#define ID_M_RETURN 8 ID_CUSTOM_6,
ID_CUSTOM_7,
ID_M_RETURN,
};
static void event_handler(lv_obj_t * obj, lv_event_t event) { static void event_handler(lv_obj_t * obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
#if ENABLED(USER_CMD_1_ENABLE) case ID_CUSTOM_1: TERN_(USER_CMD_1_ENABLE, queue.inject_P(PSTR(USER_GCODE_1))); break;
case ID_CUSTOM_1: case ID_CUSTOM_2: TERN_(USER_CMD_2_ENABLE, queue.inject_P(PSTR(USER_GCODE_2))); break;
queue.inject_P(PSTR(USER_GCODE_1)); case ID_CUSTOM_3: TERN_(USER_CMD_3_ENABLE, queue.inject_P(PSTR(USER_GCODE_3))); break;
break; case ID_CUSTOM_4: TERN_(USER_CMD_4_ENABLE, queue.inject_P(PSTR(USER_GCODE_4))); break;
#endif case ID_CUSTOM_5: TERN_(USER_CMD_5_ENABLE, queue.inject_P(PSTR(USER_GCODE_5))); break;
#if ENABLED(USER_CMD_2_ENABLE) case ID_CUSTOM_6: TERN_(USER_CMD_6_ENABLE, queue.inject_P(PSTR(USER_GCODE_6))); break;
case ID_CUSTOM_2: case ID_CUSTOM_7: TERN_(USER_CMD_7_ENABLE, queue.inject_P(PSTR(USER_GCODE_7))); break;
queue.inject_P(PSTR(USER_GCODE_2));
break;
#endif
#if ENABLED(USER_CMD_3_ENABLE)
case ID_CUSTOM_3:
queue.inject_P(PSTR(USER_GCODE_3));
break;
#endif
#if ENABLED(USER_CMD_4_ENABLE)
case ID_CUSTOM_4:
queue.inject_P(PSTR(USER_GCODE_4));
break;
#endif
#if ENABLED(USER_CMD_5_ENABLE)
case ID_CUSTOM_5:
queue.inject_P(PSTR(USER_GCODE_5));
break;
#endif
#if ENABLED(USER_CMD_6_ENABLE)
case ID_CUSTOM_6:
queue.inject_P(PSTR(USER_GCODE_6));
break;
#endif
#if ENABLED(USER_CMD_7_ENABLE)
case ID_CUSTOM_7:
queue.inject_P(PSTR(USER_GCODE_7));
break;
#endif
case ID_M_RETURN: case ID_M_RETURN:
lv_clear_more(); lv_clear_more();
lv_draw_tool(); lv_draw_tool();
@ -87,7 +62,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
} }
} }
void lv_draw_more(void) { void lv_draw_more() {
scr = lv_screen_create(MORE_UI); scr = lv_screen_create(MORE_UI);
const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable); const bool enc_ena = TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable);
@ -173,27 +148,13 @@ void lv_draw_more(void) {
#if BUTTONS_EXIST(EN1, EN2, ENC) #if BUTTONS_EXIST(EN1, EN2, ENC)
if (enc_ena) { if (enc_ena) {
#if ENABLED(USER_CMD_1_ENABLE) TERN_(USER_CMD_1_ENABLE, lv_group_add_obj(g, buttonCustom1));
lv_group_add_obj(g, buttonCustom1); TERN_(USER_CMD_2_ENABLE, lv_group_add_obj(g, buttonCustom2));
#endif TERN_(USER_CMD_3_ENABLE, lv_group_add_obj(g, buttonCustom3));
#if ENABLED(USER_CMD_2_ENABLE) TERN_(USER_CMD_4_ENABLE, lv_group_add_obj(g, buttonCustom4));
lv_group_add_obj(g, buttonCustom2); TERN_(USER_CMD_5_ENABLE, lv_group_add_obj(g, buttonCustom5));
#endif TERN_(USER_CMD_6_ENABLE, lv_group_add_obj(g, buttonCustom6));
#if ENABLED(USER_CMD_3_ENABLE) TERN_(USER_CMD_7_ENABLE, lv_group_add_obj(g, buttonCustom7));
lv_group_add_obj(g, buttonCustom3);
#endif
#if ENABLED(USER_CMD_4_ENABLE)
lv_group_add_obj(g, buttonCustom4);
#endif
#if ENABLED(USER_CMD_5_ENABLE)
lv_group_add_obj(g, buttonCustom5);
#endif
#if ENABLED(USER_CMD_6_ENABLE)
lv_group_add_obj(g, buttonCustom6);
#endif
#if ENABLED(USER_CMD_7_ENABLE)
lv_group_add_obj(g, buttonCustom7);
#endif
lv_group_add_obj(g, buttonBack); lv_group_add_obj(g, buttonBack);
} }
#endif #endif

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_more(void); extern void lv_draw_more();
extern void lv_clear_more(); extern void lv_clear_more();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -68,7 +68,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_motor_settings(void) { void lv_draw_motor_settings() {
int index = 0; int index = 0;
scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle); scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_motor_settings(void); extern void lv_draw_motor_settings();
extern void lv_clear_motor_settings(); extern void lv_clear_motor_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -90,7 +90,7 @@ void refresh_pos(lv_task_t *) {
disp_cur_pos(); disp_cur_pos();
} }
void lv_draw_move_motor(void) { void lv_draw_move_motor() {
scr = lv_screen_create(MOVE_MOTOR_UI); scr = lv_screen_create(MOVE_MOTOR_UI);
lv_obj_t *buttonXI = lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_M_X_P); lv_obj_t *buttonXI = lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_M_X_P);
lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_move_motor(void); extern void lv_draw_move_motor();
extern void lv_clear_move_motor(); extern void lv_clear_move_motor();
extern void disp_move_dist(); extern void disp_move_dist();

View File

@ -656,7 +656,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_number_key(void) { void lv_draw_number_key() {
scr = lv_screen_create(NUMBER_KEY_UI, ""); scr = lv_screen_create(NUMBER_KEY_UI, "");
buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text); buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_number_key(void); extern void lv_draw_number_key();
extern void lv_clear_number_key(); extern void lv_clear_number_key();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -114,7 +114,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_operation(void) { void lv_draw_operation() {
lv_obj_t *buttonExtrusion = nullptr, *buttonSpeed = nullptr, lv_obj_t *buttonExtrusion = nullptr, *buttonSpeed = nullptr,
*buttonBack = nullptr, *buttonBack = nullptr,
*labelPreHeat = nullptr, *labelExtrusion = nullptr, *labelPreHeat = nullptr, *labelExtrusion = nullptr,

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_operation(void); extern void lv_draw_operation();
extern void lv_clear_operation(); extern void lv_clear_operation();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -59,7 +59,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
} }
void lv_draw_pause_position(void) { void lv_draw_pause_position() {
scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText); scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_pause_position(void); extern void lv_draw_pause_position();
extern void lv_clear_pause_position(); extern void lv_clear_pause_position();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -153,7 +153,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_preHeat(void) { void lv_draw_preHeat() {
scr = lv_screen_create(PRE_HEAT_UI); scr = lv_screen_create(PRE_HEAT_UI);
// Create image buttons // Create image buttons

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_preHeat(void); extern void lv_draw_preHeat();
extern void lv_clear_preHeat(); extern void lv_clear_preHeat();
extern void disp_temp_type(); extern void disp_temp_type();
extern void disp_step_heat(); extern void disp_step_heat();

View File

@ -73,8 +73,7 @@ uint8_t sel_id = 0;
for (uint16_t i = 0; i < fileCnt; i++) { for (uint16_t i = 0; i < fileCnt; i++) {
if (list_file.Sd_file_cnt == list_file.Sd_file_offset) { if (list_file.Sd_file_cnt == list_file.Sd_file_offset) {
const uint16_t nr = SD_ORDER(i, fileCnt); card.getfilename_sorted(SD_ORDER(i, fileCnt));
card.getfilename_sorted(nr);
list_file.IsFolder[valid_name_cnt] = card.flag.filenameIsDir; list_file.IsFolder[valid_name_cnt] = card.flag.filenameIsDir;
strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath); strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath);
@ -205,7 +204,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_print_file(void) { void lv_draw_print_file() {
//uint8_t i; //uint8_t i;
uint8_t file_count; uint8_t file_count;

View File

@ -50,7 +50,7 @@ typedef struct {
extern LIST_FILE list_file; extern LIST_FILE list_file;
extern void disp_gcode_icon(uint8_t file_num); extern void disp_gcode_icon(uint8_t file_num);
extern void lv_draw_print_file(void); extern void lv_draw_print_file();
extern uint32_t lv_open_gcode_file(char *path); extern uint32_t lv_open_gcode_file(char *path);
extern void lv_gcode_file_read(uint8_t *data_buf); extern void lv_gcode_file_read(uint8_t *data_buf);
extern void lv_close_gcode_file(); extern void lv_close_gcode_file();

View File

@ -110,7 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_printing(void) { void lv_draw_printing() {
disp_state_stack._disp_index = 0; disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state); ZERO(disp_state_stack._disp_state);
scr = lv_screen_create(PRINTING_UI); scr = lv_screen_create(PRINTING_UI);

View File

@ -36,7 +36,7 @@ enum {
STOP STOP
}; };
extern void lv_draw_printing(void); extern void lv_draw_printing();
extern void lv_clear_printing(); extern void lv_clear_printing();
extern void disp_ext_temp(); extern void disp_ext_temp();
extern void disp_bed_temp(); extern void disp_bed_temp();

View File

@ -110,7 +110,7 @@ void mks_disp_test() {
#endif #endif
} }
void lv_draw_ready_print(void) { void lv_draw_ready_print() {
char buf[30] = {0}; char buf[30] = {0};
lv_obj_t *buttonTool; lv_obj_t *buttonTool;

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_ready_print(void); extern void lv_draw_ready_print();
extern void mks_disp_test(); extern void mks_disp_test();
extern void disp_Limit_ok(); extern void disp_Limit_ok();
extern void disp_Limit_error(); extern void disp_Limit_error();

View File

@ -109,7 +109,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_set(void) { void lv_draw_set() {
scr = lv_screen_create(SET_UI); scr = lv_screen_create(SET_UI);
lv_big_button_create(scr, "F:/bmp_eeprom_settings.bin", set_menu.eepromSet, INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET); lv_big_button_create(scr, "F:/bmp_eeprom_settings.bin", set_menu.eepromSet, INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET);
lv_big_button_create(scr, "F:/bmp_fan.bin", set_menu.fan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN); lv_big_button_create(scr, "F:/bmp_fan.bin", set_menu.fan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_set(void); extern void lv_draw_set();
extern void lv_clear_set(); extern void lv_clear_set();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -78,7 +78,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
} }
void lv_draw_step_settings(void) { void lv_draw_step_settings() {
scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle); scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle);
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_step_settings(void); extern void lv_draw_step_settings();
extern void lv_clear_step_settings(); extern void lv_clear_step_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -91,7 +91,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_tmc_current_settings(void) { void lv_draw_tmc_current_settings() {
scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle); scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle);
float milliamps; float milliamps;

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_tmc_current_settings(void); extern void lv_draw_tmc_current_settings();
extern void lv_clear_tmc_current_settings(); extern void lv_clear_tmc_current_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -107,7 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_tmc_step_mode_settings(void) { void lv_draw_tmc_step_mode_settings() {
buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr; buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr;
scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle); scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_tmc_step_mode_settings(void); extern void lv_draw_tmc_step_mode_settings();
extern void lv_clear_tmc_step_mode_settings(); extern void lv_clear_tmc_step_mode_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -50,25 +50,13 @@ enum {
static void event_handler(lv_obj_t *obj, lv_event_t event) { static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) if (TERN1(AUTO_BED_LEVELING_BILINEAR, obj->mks_obj_id != ID_T_LEVELING))
bool clear = (obj->mks_obj_id != ID_T_LEVELING); lv_clear_tool();
#else
constexpr bool clear = true;
#endif
if (clear) lv_clear_tool();
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_T_PRE_HEAT: case ID_T_PRE_HEAT: lv_draw_preHeat(); break;
lv_draw_preHeat(); case ID_T_EXTRUCT: lv_draw_extrusion(); break;
break; case ID_T_MOV: lv_draw_move_motor(); break;
case ID_T_EXTRUCT: case ID_T_HOME: lv_draw_home(); break;
lv_draw_extrusion();
break;
case ID_T_MOV:
lv_draw_move_motor();
break;
case ID_T_HOME:
lv_draw_home();
break;
case ID_T_LEVELING: case ID_T_LEVELING:
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m); get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m);
@ -91,7 +79,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_tool(void) { void lv_draw_tool() {
scr = lv_screen_create(TOOL_UI); scr = lv_screen_create(TOOL_UI);
lv_big_button_create(scr, "F:/bmp_preHeat.bin", tool_menu.preheat, INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT); lv_big_button_create(scr, "F:/bmp_preHeat.bin", tool_menu.preheat, INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT);
lv_big_button_create(scr, "F:/bmp_extruct.bin", tool_menu.extrude, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT); lv_big_button_create(scr, "F:/bmp_extruct.bin", tool_menu.extrude, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT);

View File

@ -25,7 +25,7 @@
extern "C" { /* C-declarations for C++ */ extern "C" { /* C-declarations for C++ */
#endif #endif
extern void lv_draw_tool(void); extern void lv_draw_tool();
extern void lv_clear_tool(); extern void lv_clear_tool();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -72,9 +72,6 @@ extern bool once_flag;
extern uint8_t sel_id; extern uint8_t sel_id;
extern lv_group_t *g; extern lv_group_t *g;
extern uint8_t bmp_public_buf[14 * 1024];
extern uint8_t public_buf[513];
extern void LCD_IO_WriteData(uint16_t RegValue); extern void LCD_IO_WriteData(uint16_t RegValue);
static const char custom_gcode_command[][100] = { static const char custom_gcode_command[][100] = {

View File

@ -444,7 +444,7 @@ extern lv_point_t line_points[4][2];
extern void gCfgItems_init(); extern void gCfgItems_init();
extern void ui_cfg_init(); extern void ui_cfg_init();
extern void tft_style_init(); extern void tft_style_init();
extern char *creat_title_text(void); extern char *creat_title_text();
extern void preview_gcode_prehandle(char *path); extern void preview_gcode_prehandle(char *path);
extern void update_spi_flash(); extern void update_spi_flash();
extern void update_gcode_command(int addr,uint8_t *s); extern void update_gcode_command(int addr,uint8_t *s);

View File

@ -59,7 +59,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_wifi(void) { void lv_draw_wifi() {
scr = lv_screen_create(WIFI_UI); scr = lv_screen_create(WIFI_UI);
lv_obj_t *buttonReconnect = nullptr, *label_Reconnect = nullptr; lv_obj_t *buttonReconnect = nullptr, *label_Reconnect = nullptr;

View File

@ -26,7 +26,7 @@
#endif #endif
extern void lv_draw_wifi(void); extern void lv_draw_wifi();
extern void lv_clear_wifi(); extern void lv_clear_wifi();
extern void disp_wifi_state(); extern void disp_wifi_state();

View File

@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_wifi_list(void) { void lv_draw_wifi_list() {
scr = lv_screen_create(WIFI_LIST_UI); scr = lv_screen_create(WIFI_LIST_UI);
lv_obj_t *buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN); lv_obj_t *buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN);
@ -130,7 +130,7 @@ void lv_draw_wifi_list(void) {
disp_wifi_list(); disp_wifi_list();
} }
void disp_wifi_list(void) { void disp_wifi_list() {
int8_t tmpStr[WIFI_NAME_BUFFER_SIZE] = { 0 }; int8_t tmpStr[WIFI_NAME_BUFFER_SIZE] = { 0 };
uint8_t i, j; uint8_t i, j;

View File

@ -27,7 +27,7 @@
extern void lv_draw_wifi_list(); extern void lv_draw_wifi_list();
extern void lv_clear_wifi_list(); extern void lv_clear_wifi_list();
extern void disp_wifi_list(void); extern void disp_wifi_list();
extern void cutWifiName(char *name, int len,char *outStr); extern void cutWifiName(char *name, int len,char *outStr);
extern void wifi_scan_handle(); extern void wifi_scan_handle();

View File

@ -93,7 +93,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
} }
void lv_draw_wifi_settings(void) { void lv_draw_wifi_settings() {
scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle); scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle);
lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode); lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode);

View File

@ -28,7 +28,7 @@
#define WIFI_AP_TEXT "AP" #define WIFI_AP_TEXT "AP"
#define WIFI_STA_TEXT "STA" #define WIFI_STA_TEXT "STA"
extern void lv_draw_wifi_settings(void); extern void lv_draw_wifi_settings();
extern void lv_clear_wifi_settings(); extern void lv_clear_wifi_settings();
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -36,7 +36,7 @@ TIPS_TYPE wifi_tips_type;
TIPS_DISP tips_disp; TIPS_DISP tips_disp;
tips_menu_def tips_menu; tips_menu_def tips_menu;
void lv_draw_wifi_tips(void) { void lv_draw_wifi_tips() {
static lv_obj_t *text_tips,*wifi_name; static lv_obj_t *text_tips,*wifi_name;
scr = lv_screen_create(WIFI_TIPS_UI, ""); scr = lv_screen_create(WIFI_TIPS_UI, "");

View File

@ -26,7 +26,7 @@
#endif #endif
extern void lv_draw_wifi_tips(void); extern void lv_draw_wifi_tips();
extern void lv_clear_wifi_tips(); extern void lv_clear_wifi_tips();
typedef enum { typedef enum {

View File

@ -45,7 +45,7 @@
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH); #define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW); #define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
void __irq_usart1(void) { void __irq_usart1() {
if ((USART1_BASE->CR1 & USART_CR1_RXNEIE) && (USART1_BASE->SR & USART_SR_RXNE)) if ((USART1_BASE->CR1 & USART_CR1_RXNEIE) && (USART1_BASE->SR & USART_SR_RXNE))
WRITE(WIFI_IO1_PIN, HIGH); WRITE(WIFI_IO1_PIN, HIGH);

View File

@ -399,7 +399,6 @@
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN "Load filament completed,\nclick <confirm> for return!" #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN "Load filament completed,\nclick <confirm> for return!"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick <confirm> for return!" #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick <confirm> for return!"
#define PRE_HEAT_EXT_TEXT_EN "E" #define PRE_HEAT_EXT_TEXT_EN "E"
#define PRE_HEAT_BED_TEXT_EN "Bed" #define PRE_HEAT_BED_TEXT_EN "Bed"

View File

@ -37,9 +37,6 @@
extern uint8_t bmp_public_buf[14 * 1024]; extern uint8_t bmp_public_buf[14 * 1024];
extern uint8_t public_buf[513]; extern uint8_t public_buf[513];
extern uint8_t bmp_public_buf[14 * 1024];
extern uint8_t public_buf[513];
extern void tft_lvgl_init(); extern void tft_lvgl_init();
extern void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p); extern void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
extern bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); extern bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
@ -48,7 +45,7 @@ extern bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * dat
extern void LCD_Clear(uint16_t Color); extern void LCD_Clear(uint16_t Color);
extern void tft_set_point(uint16_t x, uint16_t y, uint16_t point); extern void tft_set_point(uint16_t x, uint16_t y, uint16_t point);
extern void LCD_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh); extern void LCD_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh);
extern void LCD_WriteRAM_Prepare(void); extern void LCD_WriteRAM_Prepare();
extern void lcd_draw_logo(); extern void lcd_draw_logo();
extern void lv_encoder_pin_init(); extern void lv_encoder_pin_init();
extern void lv_update_encoder(); extern void lv_update_encoder();

View File

@ -1006,7 +1006,6 @@ void disp_language_init() {
filament_menu.filament_dialog_unloading = FILAMENT_DIALOG_UNLOADING_TIPS_CN; filament_menu.filament_dialog_unloading = FILAMENT_DIALOG_UNLOADING_TIPS_CN;
filament_menu.filament_dialog_unload_completed = FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_CN; filament_menu.filament_dialog_unload_completed = FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_CN;
// //
language_menu.title = TITLE_LANGUAGE_CN; language_menu.title = TITLE_LANGUAGE_CN;
language_menu.next = PAGE_DOWN_TEXT_CN; language_menu.next = PAGE_DOWN_TEXT_CN;
@ -1423,28 +1422,15 @@ void disp_language_init() {
set_menu.shutdown = SHUTDOWN_TEXT_EN; set_menu.shutdown = SHUTDOWN_TEXT_EN;
set_menu.machine_para = MACHINE_PARA_EN; set_menu.machine_para = MACHINE_PARA_EN;
set_menu.eepromSet = EEPROM_SETTINGS_EN; set_menu.eepromSet = EEPROM_SETTINGS_EN;
//
more_menu.title = TITLE_MORE_EN; more_menu.title = TITLE_MORE_EN;
#if ENABLED(USER_CMD_1_ENABLE) TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN);
more_menu.custom1 = MORE_CUSTOM1_TEXT_EN; TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN);
#endif TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN);
#if ENABLED(USER_CMD_2_ENABLE) TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_EN);
more_menu.custom2 = MORE_CUSTOM2_TEXT_EN; TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_EN);
#endif TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_EN);
#if ENABLED(USER_CMD_3_ENABLE) TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_EN);
more_menu.custom3 = MORE_CUSTOM3_TEXT_EN;
#endif
#if ENABLED(USER_CMD_4_ENABLE)
more_menu.custom4 = MORE_CUSTOM4_TEXT_EN;
#endif
#if ENABLED(USER_CMD_5_ENABLE)
more_menu.custom5 = MORE_CUSTOM5_TEXT_EN;
#endif
#if ENABLED(USER_CMD_6_ENABLE)
more_menu.custom6 = MORE_CUSTOM6_TEXT_EN;
#endif
#if ENABLED(USER_CMD_7_ENABLE)
more_menu.custom7 = MORE_CUSTOM7_TEXT_EN;
#endif
// //
filesys_menu.title = TITLE_FILESYS_EN; filesys_menu.title = TITLE_FILESYS_EN;
@ -2695,27 +2681,13 @@ void disp_language_init() {
set_menu.eepromSet = EEPROM_SETTINGS_EN; set_menu.eepromSet = EEPROM_SETTINGS_EN;
// //
more_menu.title = TITLE_MORE_EN; more_menu.title = TITLE_MORE_EN;
#if ENABLED(USER_CMD_1_ENABLE) TERN_(USER_CMD_1_ENABLE, more_menu.custom1 = MORE_CUSTOM1_TEXT_EN);
more_menu.custom1 = MORE_CUSTOM1_TEXT_EN; TERN_(USER_CMD_2_ENABLE, more_menu.custom2 = MORE_CUSTOM2_TEXT_EN);
#endif TERN_(USER_CMD_3_ENABLE, more_menu.custom3 = MORE_CUSTOM3_TEXT_EN);
#if ENABLED(USER_CMD_2_ENABLE) TERN_(USER_CMD_4_ENABLE, more_menu.custom4 = MORE_CUSTOM4_TEXT_EN);
more_menu.custom2 = MORE_CUSTOM2_TEXT_EN; TERN_(USER_CMD_5_ENABLE, more_menu.custom5 = MORE_CUSTOM5_TEXT_EN);
#endif TERN_(USER_CMD_6_ENABLE, more_menu.custom6 = MORE_CUSTOM6_TEXT_EN);
#if ENABLED(USER_CMD_3_ENABLE) TERN_(USER_CMD_7_ENABLE, more_menu.custom7 = MORE_CUSTOM7_TEXT_EN);
more_menu.custom3 = MORE_CUSTOM3_TEXT_EN;
#endif
#if ENABLED(USER_CMD_4_ENABLE)
more_menu.custom4 = MORE_CUSTOM4_TEXT_EN;
#endif
#if ENABLED(USER_CMD_5_ENABLE)
more_menu.custom5 = MORE_CUSTOM5_TEXT_EN;
#endif
#if ENABLED(USER_CMD_6_ENABLE)
more_menu.custom6 = MORE_CUSTOM6_TEXT_EN;
#endif
#if ENABLED(USER_CMD_7_ENABLE)
more_menu.custom7 = MORE_CUSTOM7_TEXT_EN;
#endif
// //
filesys_menu.title = TITLE_FILESYS_EN; filesys_menu.title = TITLE_FILESYS_EN;
filesys_menu.sd_sys = SD_CARD_TEXT_EN; filesys_menu.sd_sys = SD_CARD_TEXT_EN;

View File

@ -59,7 +59,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) {
if (with_irq) usart_enable(usart_device); if (with_irq) usart_enable(usart_device);
else { else {
usart_reg_map *regs = usart_device->regs; usart_reg_map *regs = usart_device->regs;
regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1); regs->CR1 |= (USART_CR1_TE | USART_CR1_RE); // don't change the word length etc, and 'or' in the pattern not overwrite |USART_CR1_M_8N1);
regs->CR1 |= USART_CR1_UE; regs->CR1 |= USART_CR1_UE;
} }
} }
@ -71,7 +71,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) {
if (with_irq) usart_enable(usart_device); if (with_irq) usart_enable(usart_device);
else { else {
usart_reg_map *regs = usart_device->regs; usart_reg_map *regs = usart_device->regs;
regs->CR1 |= (USART_CR1_TE | USART_CR1_RE);// don't change the word length etc, and 'or' in the patten not overwrite |USART_CR1_M_8N1); regs->CR1 |= (USART_CR1_TE | USART_CR1_RE); // don't change the word length etc, and 'or' in the pattern not overwrite |USART_CR1_M_8N1);
regs->CR1 |= USART_CR1_UE; regs->CR1 |= USART_CR1_UE;
} }
} }
@ -111,11 +111,11 @@ void WifiSerial::begin(uint32 baud, uint8_t config) {
usart_enable_no_irq(this->usart_device, baud == WIFI_BAUDRATE); usart_enable_no_irq(this->usart_device, baud == WIFI_BAUDRATE);
} }
void WifiSerial::end(void) { void WifiSerial::end() {
usart_disable(this->usart_device); usart_disable(this->usart_device);
} }
int WifiSerial::available(void) { int WifiSerial::available() {
return usart_data_available(this->usart_device); return usart_data_available(this->usart_device);
} }
@ -123,7 +123,7 @@ int WifiSerial::available(void) {
// I/O // I/O
// //
int WifiSerial::read(void) { int WifiSerial::read() {
if (usart_data_available(usart_device) <= 0) return -1; if (usart_data_available(usart_device) <= 0) return -1;
return usart_getc(usart_device); return usart_getc(usart_device);
} }
@ -133,7 +133,7 @@ int WifiSerial::write(unsigned char ch) {
return 1; return 1;
} }
int WifiSerial::wifi_rb_is_full(void) { int WifiSerial::wifi_rb_is_full() {
return rb_is_full(this->usart_device->rb); return rb_is_full(this->usart_device->rb);
} }

View File

@ -58,8 +58,8 @@ class WifiSerial {
void begin(uint32 baud); void begin(uint32 baud);
void begin(uint32 baud,uint8_t config); void begin(uint32 baud,uint8_t config);
void end(); void end();
int available(void); int available();
int read(void); int read();
int write(uint8_t); int write(uint8_t);
inline void wifi_usart_irq(usart_reg_map *regs) { inline void wifi_usart_irq(usart_reg_map *regs) {
/* Handling RXNEIE and TXEIE interrupts. /* Handling RXNEIE and TXEIE interrupts.
@ -87,8 +87,7 @@ class WifiSerial {
} }
} }
int wifi_rb_is_full(void); int wifi_rb_is_full();
struct usart_dev *usart_device; struct usart_dev *usart_device;
private: private:

View File

@ -183,7 +183,7 @@ static bool longName2DosName(const char *longName, uint8_t *dosName) {
uint8_t c = *longName++; uint8_t c = *longName++;
if (c == '.') { // For a dot... if (c == '.') { // For a dot...
if (i == 0) return false; if (i == 0) return false;
strcat((char *)dosName, ".GCO"); strcat_P((char *)dosName, PSTR(".GCO"));
break; break;
} }
else { else {
@ -194,7 +194,7 @@ static bool longName2DosName(const char *longName, uint8_t *dosName) {
dosName[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0); // Uppercase required for 8.3 name dosName[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0); // Uppercase required for 8.3 name
} }
if (i >= 5) { if (i >= 5) {
strcat((char *)dosName, "~1.GCO"); strcat_P((char *)dosName, PSTR("~1.GCO"));
break; break;
} }
} }
@ -212,7 +212,6 @@ static int storeRcvData(volatile uint8_t *bufToCpy, int32_t len) {
wifiDmaRcvFifo.write_cur = (tmpW + 1) % TRANS_RCV_FIFO_BLOCK_NUM; wifiDmaRcvFifo.write_cur = (tmpW + 1) % TRANS_RCV_FIFO_BLOCK_NUM;
return 1; return 1;
} }
return 0; return 0;
} }
@ -253,6 +252,7 @@ static void dma_ch5_irq_handle() {
WIFI_IO1_SET(); WIFI_IO1_SET();
} }
} }
static void wifi_usart_dma_init() { static void wifi_usart_dma_init() {
dma_init(DMA1); dma_init(DMA1);
uint32_t flags = ( DMA_MINC_MODE | DMA_TRNS_CMPLT | DMA_HALF_TRNS | DMA_TRNS_ERR); uint32_t flags = ( DMA_MINC_MODE | DMA_TRNS_CMPLT | DMA_HALF_TRNS | DMA_TRNS_ERR);
@ -289,7 +289,7 @@ void esp_port_begin(uint8_t interrupt) {
if (interrupt) { if (interrupt) {
for (uint16_t i = 0; i < 65535; i++) { /*nada*/ } for (uint16_t i = 0; i < 65535; i++) { /*nada*/ }
WIFISERIAL.begin(WIFI_BAUDRATE); WIFISERIAL.begin(WIFI_BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL; millis_t serial_connect_timeout = millis() + 1000UL;
while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
} }
else { else {
@ -305,7 +305,7 @@ void esp_port_begin(uint8_t interrupt) {
WIFISERIAL.end(); WIFISERIAL.end();
for (uint16_t i = 0; i < 65535; i++) { /*nada*/ } for (uint16_t i = 0; i < 65535; i++) { /*nada*/ }
WIFISERIAL.begin(interrupt ? WIFI_BAUDRATE : WIFI_UPLOAD_BAUDRATE); WIFISERIAL.begin(interrupt ? WIFI_BAUDRATE : WIFI_UPLOAD_BAUDRATE);
uint32_t serial_connect_timeout = millis() + 1000UL; millis_t serial_connect_timeout = millis() + 1000UL;
while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif #endif
if (!interrupt) wifi_usart_dma_init(); if (!interrupt) wifi_usart_dma_init();
@ -511,16 +511,16 @@ int write_to_file(char *buf, int len) {
res = upload_file.write(public_buf, file_writer.write_index); res = upload_file.write(public_buf, file_writer.write_index);
} }
} }
if (res == -1) {
return -1; if (res == -1) return -1;
}
upload_file.getpos(&pos); upload_file.getpos(&pos);
file_writer.write_index = 0; file_writer.write_index = 0;
} }
} }
if (res == -1) { if (res == -1) {
memset(public_buf, 0, sizeof(public_buf)); ZERO(public_buf);
file_writer.write_index = 0; file_writer.write_index = 0;
return -1; return -1;
} }
@ -576,17 +576,16 @@ uint8_t Explore_Disk(char* path , uint8_t recu_level) {
for (uint8_t i = 0; i < fileCnt; i++) { for (uint8_t i = 0; i < fileCnt; i++) {
card.getfilename_sorted(SD_ORDER(i, fileCnt)); card.getfilename_sorted(SD_ORDER(i, fileCnt));
ZERO(tmp);
memset(tmp, 0, sizeof(tmp));
strcpy(tmp, card.filename); strcpy(tmp, card.filename);
ZERO(Fstream); ZERO(Fstream);
strcpy(Fstream, tmp); strcpy(Fstream, tmp);
if (card.flag.filenameIsDir && recu_level <= 10) if (card.flag.filenameIsDir && recu_level <= 10)
strcat(Fstream, ".DIR"); strcat_P(Fstream, PSTR(".DIR"));
strcat(Fstream, "\r\n"); strcat_P(Fstream, PSTR("\r\n"));
send_to_wifi((uint8_t*)Fstream, strlen(Fstream)); send_to_wifi((uint8_t*)Fstream, strlen(Fstream));
} }
@ -662,23 +661,23 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
int index = 0; int index = 0;
while (tmpStr[index] == ' ') index++; while (tmpStr[index] == ' ') index++;
if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) { if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) {
if (strlen((char *)&tmpStr[index]) < 80) { if (strlen((char *)&tmpStr[index]) < 80) {
ZERO(list_file.file_name[sel_id]); ZERO(list_file.file_name[sel_id]);
ZERO(list_file.long_name[sel_id]); ZERO(list_file.long_name[sel_id]);
uint8_t has_path_selected = 0; uint8_t has_path_selected = 0;
if (gCfgItems.wifi_type == ESP_WIFI) { if (gCfgItems.wifi_type == ESP_WIFI) {
if (strncmp((char *)&tmpStr[index], "1:", 2) == 0) { if (strncmp_P((char *)&tmpStr[index], PSTR("1:"), 2) == 0) {
gCfgItems.fileSysType = FILE_SYS_SD; gCfgItems.fileSysType = FILE_SYS_SD;
has_path_selected = 1; has_path_selected = 1;
} }
else if (strncmp((char *)&tmpStr[index], "0:", 2) == 0) { else if (strncmp_P((char *)&tmpStr[index], PSTR("0:"), 2) == 0) {
gCfgItems.fileSysType = FILE_SYS_USB; gCfgItems.fileSysType = FILE_SYS_USB;
has_path_selected = 1; has_path_selected = 1;
} }
else if (tmpStr[index] != '/') else if (tmpStr[index] != '/')
strcat((char *)list_file.file_name[sel_id], "/"); strcat_P((char *)list_file.file_name[sel_id], PSTR("/"));
if (file_writer.fileTransfer == 1) { if (file_writer.fileTransfer == 1) {
uint8_t dosName[FILENAME_LENGTH]; uint8_t dosName[FILENAME_LENGTH];
@ -686,12 +685,11 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
fileName[0] = '\0'; fileName[0] = '\0';
if (has_path_selected == 1) { if (has_path_selected == 1) {
strcat((char *)fileName, (char *)&tmpStr[index + 3]); strcat((char *)fileName, (char *)&tmpStr[index + 3]);
strcat((char *)list_file.file_name[sel_id], "/"); strcat_P((char *)list_file.file_name[sel_id], PSTR("/"));
} }
else strcat((char *)fileName, (char *)&tmpStr[index]); else strcat((char *)fileName, (char *)&tmpStr[index]);
if (!longName2DosName((const char *)fileName, dosName)) { if (!longName2DosName((const char *)fileName, dosName))
strcpy(list_file.file_name[sel_id], "notValid"); strcpy_P(list_file.file_name[sel_id], PSTR("notValid"));
}
strcat((char *)list_file.file_name[sel_id], (char *)dosName); strcat((char *)list_file.file_name[sel_id], (char *)dosName);
strcat((char *)list_file.long_name[sel_id], (char *)dosName); strcat((char *)list_file.long_name[sel_id], (char *)dosName);
} }
@ -712,7 +710,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n")); send_to_wifi((uint8_t *)"File selected\r\n", strlen("File selected\r\n"));
else { else {
send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n")); send_to_wifi((uint8_t *)"file.open failed\r\n", strlen("file.open failed\r\n"));
strcpy(list_file.file_name[sel_id], "notValid"); strcpy_P(list_file.file_name[sel_id], PSTR("notValid"));
} }
SEND_OK_TO_WIFI; SEND_OK_TO_WIFI;
} }
@ -721,7 +719,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
break; break;
case 24: case 24:
if (strcmp(list_file.file_name[sel_id], "notValid") != 0) { if (strcmp_P(list_file.file_name[sel_id], PSTR("notValid")) != 0) {
if (uiCfg.print_state == IDLE) { if (uiCfg.print_state == IDLE) {
clear_cur_ui(); clear_cur_ui();
reset_print_time(); reset_print_time();
@ -830,7 +828,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)|| (uiCfg.print_state == REPRINTING)) { if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)|| (uiCfg.print_state == REPRINTING)) {
print_rate = uiCfg.totalSend; print_rate = uiCfg.totalSend;
ZERO(tempBuf); ZERO(tempBuf);
sprintf((char *)tempBuf, "M27 %d\r\n", print_rate); sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate);
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
} }
break; break;
@ -842,16 +840,16 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
int index = 0; int index = 0;
while (tmpStr[index] == ' ') index++; while (tmpStr[index] == ' ') index++;
if (strstr((char *)&tmpStr[index], ".g") || strstr((char *)&tmpStr[index], ".G")) { if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) {
strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]);
if (gCfgItems.fileSysType == FILE_SYS_SD) { if (gCfgItems.fileSysType == FILE_SYS_SD) {
ZERO(tempBuf); ZERO(tempBuf);
sprintf((char *)tempBuf, "%s", file_writer.saveFileName); sprintf_P((char *)tempBuf, PSTR("%s"), file_writer.saveFileName);
} }
else if (gCfgItems.fileSysType == FILE_SYS_USB) { else if (gCfgItems.fileSysType == FILE_SYS_USB) {
ZERO(tempBuf); ZERO(tempBuf);
sprintf((char *)tempBuf, "%s", (char *)file_writer.saveFileName); sprintf_P((char *)tempBuf, PSTR("%s"), (char *)file_writer.saveFileName);
} }
mount_file_sys(gCfgItems.fileSysType); mount_file_sys(gCfgItems.fileSysType);
@ -862,7 +860,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
ZERO(file_writer.saveFileName); ZERO(file_writer.saveFileName);
strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]); strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]);
ZERO(tempBuf); ZERO(tempBuf);
sprintf((char *)tempBuf, "Writing to file: %s\r\n", (char *)file_writer.saveFileName); sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName);
wifi_ret_ack(); wifi_ret_ack();
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
wifi_link_state = WIFI_WAIT_TRANS_START; wifi_link_state = WIFI_WAIT_TRANS_START;
@ -881,7 +879,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
ZERO(tempBuf); ZERO(tempBuf);
if (cmd_value == 105) { if (cmd_value == 105) {
SEND_OK_TO_WIFI; SEND_OK_TO_WIFI;
sprintf((char *)tempBuf,"T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n", sprintf_P((char *)tempBuf, PSTR("T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:%.1f /%.1f @:0 B@:0\r\n"),
(float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target, (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target,
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -890,7 +888,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
0.0f, 0.0f, 0.0f, 0.0f,
#endif #endif
(float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target, (float)thermalManager.temp_hotend[0].celsius, (float)thermalManager.temp_hotend[0].target,
#if !defined(SINGLENOZZLE) && HAS_MULTI_EXTRUDER #if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
(float)thermalManager.temp_hotend[1].celsius, (float)thermalManager.temp_hotend[1].target (float)thermalManager.temp_hotend[1].celsius, (float)thermalManager.temp_hotend[1].target
#else #else
0.0f, 0.0f 0.0f, 0.0f
@ -898,7 +896,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
); );
} }
else { else {
sprintf((char *)tempBuf,"T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n", sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -907,7 +905,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
0, 0, 0, 0,
#endif #endif
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
#if !defined(SINGLENOZZLE) && HAS_MULTI_EXTRUDER #if DISABLED(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
(int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target
#else #else
0, 0 0, 0
@ -922,7 +920,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
case 992: case 992:
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) {
ZERO(tempBuf); ZERO(tempBuf);
sprintf((char *)tempBuf, "M992 %d%d:%d%d:%d%d\r\n", print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10); sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10);
wifi_ret_ack(); wifi_ret_ack();
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
} }
@ -932,7 +930,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) { if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) {
ZERO(tempBuf); ZERO(tempBuf);
if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return; if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return;
sprintf((char *)tempBuf, "M994 %s;%d\n", list_file.file_name[sel_id],(int)gCfgItems.curFilesize); sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize);
wifi_ret_ack(); wifi_ret_ack();
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf)); send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
} }
@ -976,7 +974,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
break; break;
default: default:
strcat((char *)cmd_line, "\n"); strcat_P((char *)cmd_line, PSTR("\n"));
if (espGcodeFifo.wait_tick > 5) { if (espGcodeFifo.wait_tick > 5) {
uint32_t left; uint32_t left;
@ -1002,7 +1000,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
} }
} }
else { else {
strcat((char *)cmd_line, "\n"); strcat_P((char *)cmd_line, PSTR("\n"));
if (espGcodeFifo.wait_tick > 5) { if (espGcodeFifo.wait_tick > 5) {
uint32_t left_g; uint32_t left_g;
@ -1045,7 +1043,7 @@ static void net_msg_handle(uint8_t * msg, uint16_t msgLen) {
if (msgLen <= 0) return; if (msgLen <= 0) return;
// ip // ip
sprintf(ipPara.ip_addr, "%d.%d.%d.%d", msg[0], msg[1], msg[2], msg[3]); sprintf_P(ipPara.ip_addr, PSTR("%d.%d.%d.%d"), msg[0], msg[1], msg[2], msg[3]);
// port // port
// connect state // connect state
@ -1148,11 +1146,10 @@ static void wifi_list_msg_handle(uint8_t * msg, uint16_t msgLen) {
break; break;
} }
} }
if (wifi_name_is_same != 1) {
if (str[0] > 0x80) { if (wifi_name_is_same != 1 && str[0] > 0x80)
wifi_name_is_same = 1; wifi_name_is_same = 1;
}
}
if (wifi_name_is_same == 1) { if (wifi_name_is_same == 1) {
wifi_name_is_same = 0; wifi_name_is_same = 0;
wifiMsgIdex += wifiNameLen; wifiMsgIdex += wifiNameLen;
@ -1216,7 +1213,6 @@ void utf8_2_unicode(uint8_t *source,uint8_t Len) {
} }
else if (char_byte_num == 0XC0 || char_byte_num == 0XD0) { else if (char_byte_num == 0XC0 || char_byte_num == 0XD0) {
//--2byte //--2byte
u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2; u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2;
u16_l = ((uint16_t)source[i + 1] & 0x003F); u16_l = ((uint16_t)source[i + 1] & 0x003F);
u16_value = (u16_h | u16_l); u16_value = (u16_h | u16_l);
@ -1241,9 +1237,9 @@ void utf8_2_unicode(uint8_t *source,uint8_t Len) {
i += 4; i += 4;
//char_i += 3; //char_i += 3;
} }
else { else
break; break;
}
if (i >= Len || i >= 255) break; if (i >= Len || i >= 255) break;
} }
COPY(source, FileName_unicode); COPY(source, FileName_unicode);
@ -1297,7 +1293,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE); lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
return; return;
} }
sprintf((char *)saveFilePath, "%s", dosName); sprintf_P((char *)saveFilePath, PSTR("%s"), dosName);
card.cdroot(); card.cdroot();
upload_file.close(); upload_file.close();
@ -1386,8 +1382,7 @@ static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) {
} }
void esp_data_parser(char *cmdRxBuf, int len) { void esp_data_parser(char *cmdRxBuf, int len) {
int32_t head_pos; int32_t head_pos, tail_pos;
int32_t tail_pos;
uint16_t cpyLen; uint16_t cpyLen;
int16_t leftLen = len; int16_t leftLen = len;
bool loop_again = false; bool loop_again = false;

View File

@ -338,6 +338,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
// Extract elements from the header // Extract elements from the header
resp = (uint8_t)getData(1, hdr, 0); resp = (uint8_t)getData(1, hdr, 0);
opRet = (uint8_t)getData(1, hdr, 1); opRet = (uint8_t)getData(1, hdr, 1);
// Sync packets often provoke a response with a zero opcode instead of ESP_SYNC // Sync packets often provoke a response with a zero opcode instead of ESP_SYNC
if (resp != 0x01 || opRet != op) return respHeader; if (resp != 0x01 || opRet != op) return respHeader;
@ -666,14 +667,12 @@ int32_t wifi_upload(int type) {
ResetWiFiForUpload(0); ResetWiFiForUpload(0);
if (type == 0) switch (type) {
SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); case 0: SendUpdateFile(ESP_FIRMWARE_FILE, FirmwareAddress); break;
else if (type == 1) case 1: SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); break;
SendUpdateFile(ESP_WEB_FIRMWARE_FILE, FirmwareAddress); case 2: SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); break;
else if (type == 2) default: return -1;
SendUpdateFile(ESP_WEB_FILE, WebFilesAddress); }
else
return -1;
while (esp_upload.state != upload_idle) { while (esp_upload.state != upload_idle) {
upload_spin(); upload_spin();

View File

@ -142,7 +142,6 @@ void TFT_Queue::canvas(queueTask_t *task) {
if (Canvas.ToScreen()) task->state = TASK_STATE_COMPLETED; if (Canvas.ToScreen()) task->state = TASK_STATE_COMPLETED;
} }
void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { void TFT_Queue::fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) {
finish_sketch(); finish_sketch();

View File

@ -330,10 +330,9 @@ void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, ui
pBuffer += count; pBuffer += count;
SPI_FLASH_PageWrite(pBuffer, WriteAddr, temp); SPI_FLASH_PageWrite(pBuffer, WriteAddr, temp);
} }
else { else
SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite); SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
} }
}
else { // NumByteToWrite > SPI_FLASH_PageSize else { // NumByteToWrite > SPI_FLASH_PageSize
NumByteToWrite -= count; NumByteToWrite -= count;
NumOfPage = NumByteToWrite / SPI_FLASH_PageSize; NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
@ -387,9 +386,9 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint
pBuffer++; pBuffer++;
} }
} }
else { else
spi_flash_Read(pBuffer, NumByteToRead); spi_flash_Read(pBuffer, NumByteToRead);
}
W25QXX_CS_H; W25QXX_CS_H;
} }