1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

🚸 Fix and improve MKS LVGL UI (#22783)

Co-authored-by: makerbase <4164049@qq.com>
Co-authored-by: MKS-Sean <56996910+MKS-Sean@users.noreply.github.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Sola 2021-09-16 19:48:24 +08:00 committed by Scott Lahteine
parent ab9609146f
commit 4d113c2efd
38 changed files with 320 additions and 283 deletions

View File

@ -43,9 +43,9 @@ uint32_t SPIFlashStorage::m_startAddress;
static uint32_t rle_compress(T *output, uint32_t outputLength, T *input, uint32_t inputLength, uint32_t& inputProcessed) {
uint32_t count = 0, out = 0, index, i;
T pixel;
//32767 for uint16_t
//127 for uint16_t
//calculated at compile time
// 32767 for uint16_t
// 127 for uint16_t
// calculated at compile time
constexpr T max = (0xFFFFFFFF >> (8 * (4 - sizeof(T)))) / 2;
inputProcessed = 0;

View File

@ -69,14 +69,14 @@ void TFT::LCD_init() {
}
void TFT::LCD_clear(uint16_t color) {
setWindow(0, 0, (TFT_WIDTH), (TFT_HEIGHT));
tftio.WriteMultiple(color, (uint32_t)(TFT_WIDTH) * (TFT_HEIGHT));
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
tftio.WriteMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT));
}
void TFT::LCD_Draw_Logo() {
#if HAS_LOGO_IN_FLASH
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
for (uint16_t i = 0; i < (TFT_HEIGHT); i ++) {
for (uint16_t i = 0; i < (TFT_HEIGHT); i++) {
Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
tftio.WriteSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
}

View File

@ -57,9 +57,9 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break;
#if ENABLED(MKS_WIFI_MODULE)
case ID_WIFI_PARA:
lv_clear_advance_settings();
lv_draw_wifi_settings();
break;
lv_clear_advance_settings();
lv_draw_wifi_settings();
break;
#endif
#if HAS_ROTARY_ENCODER
case ID_ENCODER_SETTINGS:

View File

@ -55,7 +55,7 @@ enum {
ID_BABY_STEP_RETURN
};
static float babystep_dist=0.01;
static float babystep_dist = 0.01;
static uint8_t has_adjust_z = 0;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
@ -124,9 +124,8 @@ void lv_draw_baby_stepping() {
buttonV = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_BABY_STEP_DIST);
labelV = lv_label_create_empty(buttonV);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
if (gCfgItems.encoder_enable)
lv_group_add_obj(g, buttonV);
}
#endif
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_BABY_STEP_RETURN);

View File

@ -22,7 +22,7 @@
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
extern "C" { /* C-declarations for C++ */
#endif
void lv_draw_cloud_bind();

View File

@ -103,15 +103,13 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
if (card.isFileOpen()) {
feedrate_percentage = 100;
planner.flow_percentage[0] = 100;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = 100;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
#endif
card.startOrResumeFilePrinting();
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.prepare();
#endif
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
once_flag = false;
}
}
@ -229,14 +227,14 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_t *labelDialog = lv_label_create(scr, "");
if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_HEAT)) {
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DIALOG_IS(PAUSE_MESSAGE_PARKING, PAUSE_MESSAGE_CHANGING, PAUSE_MESSAGE_UNLOAD, PAUSE_MESSAGE_LOAD, PAUSE_MESSAGE_PURGE, PAUSE_MESSAGE_RESUME, PAUSE_MESSAGE_HEATING)) {
// nothing to do
@ -269,7 +267,7 @@ void lv_draw_dialog(uint8_t type) {
}
#endif
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT)) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X+90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
@ -287,7 +285,7 @@ void lv_draw_dialog(uint8_t type) {
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
filament_bar = lv_bar_create(scr, nullptr);
lv_obj_set_pos(filament_bar, (TFT_WIDTH-400)/2, ((TFT_HEIGHT - titleHeight)-40)/2);
lv_obj_set_pos(filament_bar, (TFT_WIDTH - 400) / 2, ((TFT_HEIGHT - titleHeight) - 40) / 2);
lv_obj_set_size(filament_bar, 400, 25);
lv_bar_set_style(filament_bar, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
lv_bar_set_anim_time(filament_bar, 1000);
@ -301,11 +299,11 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel); // Add a label to the button
if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
}
else {
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
}
}

View File

@ -44,9 +44,11 @@ enum {
ID_F_RETURN
};
uint8_t fanPercent = 0;
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
uint8_t fanPercent = map(thermalManager.fan_speed[0], 0, 255, 0, 100);
const uint8_t temp = map(thermalManager.fan_speed[0], 0, 255, 0, 100);
if (abs(fanPercent - temp) > 2) fanPercent = temp;
switch (obj->mks_obj_id) {
case ID_F_ADD: if (fanPercent < 100) fanPercent++; break;
case ID_F_DEC: if (fanPercent != 0) fanPercent--; break;
@ -56,6 +58,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_F_RETURN: clear_cur_ui(); draw_return_ui(); return;
}
thermalManager.set_fan_speed(0, map(fanPercent, 0, 100, 0, 255));
if (obj->mks_obj_id != ID_F_RETURN) disp_fan_value();
}
void lv_draw_fan() {
@ -63,7 +66,7 @@ void lv_draw_fan() {
scr = lv_screen_create(FAN_UI);
// Create an Image button
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
lv_big_button_create(scr, "F:/bmp_Dec.bin", fan_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_F_DEC);
lv_big_button_create(scr, "F:/bmp_speed255.bin", fan_menu.full, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_F_HIGH);
@ -78,7 +81,7 @@ void lv_draw_fan() {
void disp_fan_value() {
#if HAS_FAN
sprintf_P(public_buf_l, PSTR("%s: %3d%%"), fan_menu.state, (int)map(thermalManager.fan_speed[0], 0, 255, 0, 100));
sprintf_P(public_buf_l, PSTR("%s: %3d%%"), fan_menu.state, fanPercent);
#else
sprintf_P(public_buf_l, PSTR("%s: ---"), fan_menu.state);
#endif

View File

@ -52,7 +52,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_FILAMNT_IN:
uiCfg.filament_load_heat_flg = true;
if (ABS(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.wholeDegHotend(uiCfg.extruderIndex)) <= 1
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)) {
|| gCfgItems.filament_limit_temp <= thermalManager.wholeDegHotend(uiCfg.extruderIndex)
) {
lv_clear_filament_change();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
}
@ -115,9 +116,8 @@ void lv_draw_filament_change() {
buttonType = lv_imgbtn_create(scr, nullptr, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FILAMNT_TYPE);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
if (gCfgItems.encoder_enable)
lv_group_add_obj(g, buttonType);
}
#endif
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_FILAMNT_RETURN);

View File

@ -30,7 +30,7 @@
#include "../../../inc/MarlinConfig.h"
extern lv_group_t *g;
static lv_obj_t *scr,*outL,*outV = 0;
static lv_obj_t *scr, *outL, *outV = 0;
static int currentWritePos = 0;
extern uint8_t public_buf[513];
extern "C" { extern char public_buf_m[100]; }
@ -59,7 +59,7 @@ void lv_show_gcode_output(void * that, const char * txt) {
if (!memcmp(txt, "echo:", 5)) {
public_buf[0] = 0; // Clear output buffer
return;
}
}
// Avoid overflow if the answer is too large
size_t len = strlen((const char*)public_buf), tlen = strlen(txt);
@ -69,17 +69,17 @@ void lv_show_gcode_output(void * that, const char * txt) {
}
}
void lv_serial_capt_hook(void * userPointer, uint8_t c)
{
void lv_serial_capt_hook(void * userPointer, uint8_t c) {
if (c == '\n' || currentWritePos == sizeof(public_buf_m) - 1) { // End of line, probably end of command anyway
public_buf_m[currentWritePos] = 0;
lv_show_gcode_output(userPointer, public_buf_m);
currentWritePos = 0;
}
else public_buf_m[currentWritePos++] = c;
else
public_buf_m[currentWritePos++] = c;
}
void lv_eom_hook(void *)
{
void lv_eom_hook(void *) {
// Message is done, let's remove the hook now
MYSERIAL1.setHook();
// We are back from the keyboard, so let's redraw ourselves

View File

@ -67,10 +67,10 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break;
#if Z2_SENSORLESS
case ID_SENSITIVITY_Z2:
value = z2_sensitivity;
lv_clear_homing_sensitivity_settings();
lv_draw_number_key();
break;
value = z2_sensitivity;
lv_clear_homing_sensitivity_settings();
lv_draw_number_key();
break;
#endif
}
}

View File

@ -41,10 +41,10 @@ static const char * kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_lc_map[] = {
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n",
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n",
@ -52,32 +52,33 @@ static const char * kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_uc_map[] = {
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
LV_KB_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KB_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
static const char * kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", ".", LV_SYMBOL_BACKSPACE, "\n",
static const char * kb_map_spec[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", LV_SYMBOL_BACKSPACE, "\n",
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""};
static const lv_btnm_ctrl_t kb_ctrl_spec_map[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
LV_KB_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2};
static const lv_btnm_ctrl_t kb_ctrl_num_map[] = {
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, 2,
1, 1, 1, 1, 1};
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2,
1, 1, 1, 2,
1, 1, 1, 1, 1
};
static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
if (event != LV_EVENT_VALUE_CHANGED) return;
lv_kb_ext_t * ext = (lv_kb_ext_t * )lv_obj_get_ext_attr(kb);
lv_kb_ext_t *ext = (lv_kb_ext_t*)lv_obj_get_ext_attr(kb);
const uint16_t btn_id = lv_btnm_get_active_btn(kb);
if (btn_id == LV_BTNM_BTN_NONE) return;
if (lv_btnm_get_btn_ctrl(kb, btn_id, LV_BTNM_CTRL_HIDDEN | LV_BTNM_CTRL_INACTIVE)) return;
@ -120,12 +121,12 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
switch (keyboard_value) {
#if ENABLED(MKS_WIFI_MODULE)
case wifiName:
memcpy(uiCfg.wifi_name,ret_ta_txt,sizeof(uiCfg.wifi_name));
memcpy(uiCfg.wifi_name, ret_ta_txt, sizeof(uiCfg.wifi_name));
lv_clear_keyboard();
draw_return_ui();
break;
case wifiPassWord:
memcpy(uiCfg.wifi_key,ret_ta_txt,sizeof(uiCfg.wifi_name));
memcpy(uiCfg.wifi_key, ret_ta_txt, sizeof(uiCfg.wifi_name));
lv_clear_keyboard();
draw_return_ui();
break;
@ -157,8 +158,8 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
#endif // MKS_WIFI_MODULE
case autoLevelGcodeCommand:
uint8_t buf[100];
strncpy((char *)buf,ret_ta_txt,sizeof(buf));
update_gcode_command(AUTO_LEVELING_COMMAND_ADDR,buf);
strncpy((char *)buf, ret_ta_txt, sizeof(buf));
update_gcode_command(AUTO_LEVELING_COMMAND_ADDR, buf);
lv_clear_keyboard();
draw_return_ui();
break;
@ -176,7 +177,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
}
else
lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide it cursor if needed
return;
return;
}
// Add the characters to the text area if set
@ -223,16 +224,16 @@ void lv_draw_keyboard() {
static lv_style_t rel_style, pr_style;
lv_style_copy(&rel_style, &lv_style_btn_rel);
rel_style.body.radius = 0;
rel_style.body.radius = 0;
rel_style.body.border.width = 1;
rel_style.body.main_color = lv_color_make(0xA9, 0x62, 0x1D);
rel_style.body.grad_color = lv_color_make(0xA7, 0x59, 0x0E);
rel_style.body.main_color = lv_color_make(0xA9, 0x62, 0x1D);
rel_style.body.grad_color = lv_color_make(0xA7, 0x59, 0x0E);
lv_style_copy(&pr_style, &lv_style_btn_pr);
pr_style.body.radius = 0;
pr_style.body.radius = 0;
pr_style.body.border.width = 1;
pr_style.body.main_color = lv_color_make(0x72, 0x42, 0x15);
pr_style.body.grad_color = lv_color_make(0x6A, 0x3A, 0x0C);
pr_style.body.main_color = lv_color_make(0x72, 0x42, 0x15);
pr_style.body.grad_color = lv_color_make(0x6A, 0x3A, 0x0C);
// Create a keyboard and apply the styles
lv_obj_t *kb = lv_kb_create(scr, nullptr);
@ -251,9 +252,9 @@ void lv_draw_keyboard() {
lv_obj_align(ta, nullptr, LV_ALIGN_IN_TOP_MID, 0, 10);
switch (keyboard_value) {
case autoLevelGcodeCommand:
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m);
public_buf_m[sizeof(public_buf_m)-1] = 0;
lv_ta_set_text(ta, public_buf_m);
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR, (uint8_t *)public_buf_m);
public_buf_m[sizeof(public_buf_m) - 1] = '\0';
lv_ta_set_text(ta, public_buf_m);
break;
case GCodeCommand:
// Start with uppercase by default
@ -261,7 +262,7 @@ void lv_draw_keyboard() {
lv_btnm_set_ctrl_map(kb, kb_ctrl_uc_map);
// Fallthrough
default:
lv_ta_set_text(ta, "");
lv_ta_set_text(ta, "");
}
// Assign the text area to the keyboard
@ -272,5 +273,4 @@ void lv_clear_keyboard() {
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI

View File

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

View File

@ -32,10 +32,17 @@
static lv_obj_t *scr;
extern lv_group_t* g;
static lv_obj_t *buttonType, *buttonStep;
static lv_obj_t *buttonType, *buttonStep, *buttonAdd, *buttonDec;
static lv_obj_t *labelType;
static lv_obj_t *labelStep;
static lv_obj_t *tempText1;
static lv_obj_t *btn_pla;
static lv_obj_t *btn_abs;
static lv_obj_t *label_abs;
static lv_obj_t *label_pla;
static lv_style_t btn_style_pre;
static lv_style_t btn_style_rel;
enum {
ID_P_ADD = 1,
@ -43,7 +50,9 @@ enum {
ID_P_TYPE,
ID_P_STEP,
ID_P_OFF,
ID_P_RETURN
ID_P_RETURN,
ID_P_ABS,
ID_P_PLA
};
static void event_handler(lv_obj_t *obj, lv_event_t event) {
@ -55,10 +64,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
if (uiCfg.extruderIndex == 0)
max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
#if HAS_MULTI_HOTEND
else
else {
#if HAS_MULTI_HOTEND
max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
#endif
#endif
}
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
@ -83,16 +93,16 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
}
#if HAS_HEATED_BED
else {
else {
#if HAS_HEATED_BED
if (thermalManager.degTargetBed() > uiCfg.stepHeat)
thermalManager.temp_bed.target -= uiCfg.stepHeat;
else
thermalManager.setTargetBed(0);
thermalManager.start_watching_bed();
}
#endif
#endif
}
disp_desire_temp();
break;
case ID_P_TYPE:
@ -102,25 +112,24 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
uiCfg.extruderIndex = 1;
}
else if (uiCfg.extruderIndex == 1) {
if (TEMP_SENSOR_BED != 0) {
if (ENABLED(HAS_HEATED_BED)) {
uiCfg.curTempType = 1;
}
else {
uiCfg.curTempType = 0;
uiCfg.curTempType = 0;
uiCfg.extruderIndex = 0;
}
}
}
else if (uiCfg.extruderIndex == 0) {
if (TEMP_SENSOR_BED != 0)
uiCfg.curTempType = 1;
else
uiCfg.curTempType = 0;
uiCfg.curTempType = TERN(HAS_HEATED_BED, 1, 0);
}
}
else if (uiCfg.curTempType == 1) {
uiCfg.extruderIndex = 0;
uiCfg.curTempType = 0;
uiCfg.curTempType = 0;
disp_add_dec();
disp_ext_heart();
}
disp_temp_type();
break;
@ -138,30 +147,44 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
}
#if HAS_HEATED_BED
else {
else {
#if HAS_HEATED_BED
thermalManager.temp_bed.target = 0;
thermalManager.start_watching_bed();
}
#endif
#endif
}
disp_desire_temp();
break;
case ID_P_RETURN:
clear_cur_ui();
draw_return_ui();
break;
case ID_P_ABS:
thermalManager.setTargetHotend(PREHEAT_2_TEMP_HOTEND, 0);
break;
case ID_P_PLA:
thermalManager.setTargetHotend(PREHEAT_1_TEMP_HOTEND, 0);
break;
}
}
void disp_add_dec() {
// Create image buttons
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", preheat_menu.add, INTERVAL_V, titleHeight, event_handler, ID_P_ADD);
buttonDec = lv_big_button_create(scr, "F:/bmp_Dec.bin", preheat_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_DEC);
}
void lv_draw_preHeat() {
scr = lv_screen_create(PRE_HEAT_UI);
// Create image buttons
lv_big_button_create(scr, "F:/bmp_Add.bin", preheat_menu.add, INTERVAL_V, titleHeight, event_handler, ID_P_ADD);
lv_big_button_create(scr, "F:/bmp_Dec.bin", preheat_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_DEC);
disp_add_dec();
buttonType = lv_imgbtn_create(scr, nullptr, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_TYPE);
buttonStep = lv_imgbtn_create(scr, nullptr, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_P_STEP);
if (uiCfg.curTempType == 0) disp_ext_heart();
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) {
lv_group_add_obj(g, buttonType);
@ -184,26 +207,38 @@ void lv_draw_preHeat() {
disp_desire_temp();
}
void disp_ext_heart() {
btn_abs = lv_btn_create(scr, 160, 40, 80, 40, event_handler, ID_P_ABS);
btn_pla = lv_btn_create(scr, 260, 40, 80, 40, event_handler, ID_P_PLA);
lv_btn_set_style(btn_abs, LV_BTN_STYLE_PR, &btn_style_pre);
lv_btn_set_style(btn_abs, LV_BTN_STYLE_REL, &btn_style_rel);
lv_btn_set_style(btn_pla, LV_BTN_STYLE_PR, &btn_style_pre);
lv_btn_set_style(btn_pla, LV_BTN_STYLE_REL, &btn_style_rel);
label_abs = lv_label_create(btn_abs, PREHEAT_2_LABEL);
label_pla = lv_label_create(btn_pla, PREHEAT_1_LABEL);
}
void disp_temp_type() {
if (uiCfg.curTempType == 0) {
if (uiCfg.extruderIndex == 1) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
else {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext1);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
}
else {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.hotbed);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);

View File

@ -30,6 +30,8 @@ void lv_clear_preHeat();
void disp_temp_type();
void disp_step_heat();
void disp_desire_temp();
void disp_ext_heart();
void disp_add_dec();
#ifdef __cplusplus
} /* C-declarations for C++ */

View File

@ -160,8 +160,8 @@ void lv_draw_printing() {
buttonZpos = lv_imgbtn_create(scr, "F:/bmp_zpos_state.bin", 350, 86, event_handler, ID_BABYSTEP);
buttonPause = lv_imgbtn_create(scr, uiCfg.print_state == WORKING ? "F:/bmp_pause.bin" : "F:/bmp_resume.bin", 5, 240, event_handler, ID_PAUSE);
buttonStop = lv_imgbtn_create(scr, "F:/bmp_stop.bin", 165, 240, event_handler, ID_STOP);
buttonPause = lv_imgbtn_create(scr, uiCfg.print_state == WORKING ? "F:/bmp_pause.bin" : "F:/bmp_resume.bin", 5, 240, event_handler, ID_PAUSE);
buttonStop = lv_imgbtn_create(scr, "F:/bmp_stop.bin", 165, 240, event_handler, ID_STOP);
buttonOperat = lv_imgbtn_create(scr, "F:/bmp_operate.bin", 325, 240, event_handler, ID_OPTION);
#if HAS_ROTARY_ENCODER
@ -185,7 +185,7 @@ void lv_draw_printing() {
labelBed = lv_label_create(scr, 250, 196, nullptr);
#endif
labelFan = lv_label_create(scr, 395, 196, nullptr);
labelFan = lv_label_create(scr, 395, 196, nullptr);
labelTime = lv_label_create(scr, 250, 96, nullptr);
labelZpos = lv_label_create(scr, 395, 96, nullptr);
@ -210,8 +210,8 @@ void lv_draw_printing() {
lv_bar_set_style(bar1, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
lv_bar_set_anim_time(bar1, 1000);
lv_bar_set_value(bar1, 0, LV_ANIM_ON);
bar1ValueText = lv_label_create_empty(bar1);
lv_label_set_text(bar1ValueText,"0%");
bar1ValueText = lv_label_create_empty(bar1);
lv_label_set_text(bar1ValueText, "0%");
lv_obj_align(bar1ValueText, bar1, LV_ALIGN_CENTER, 0, 0);
disp_ext_temp();
@ -291,7 +291,7 @@ void setProBarRate() {
if (disp_state == PRINTING_UI) {
lv_bar_set_value(bar1, rate, LV_ANIM_ON);
sprintf_P(public_buf_l, "%d%%", rate);
lv_label_set_text(bar1ValueText,public_buf_l);
lv_label_set_text(bar1ValueText, public_buf_l);
lv_obj_align(bar1ValueText, bar1, LV_ALIGN_CENTER, 0, 0);
if (marlin_state == MF_SD_COMPLETE) {

View File

@ -43,7 +43,7 @@
#include "mks_hardware.h"
#include <stdio.h>
#define ICON_POS_Y 38
#define ICON_POS_Y 260
#define TARGET_LABEL_MOD_Y -36
#define LABEL_MOD_Y 30
@ -183,16 +183,16 @@ void lv_draw_ready_print() {
lv_label_set_text(det_info, " ");
}
else {
lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 150, event_handler, ID_TOOL);
lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 150, event_handler, ID_SET);
lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 150, event_handler, ID_PRINT);
lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 90, event_handler, ID_TOOL);
lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 90, event_handler, ID_SET);
lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 90, event_handler, ID_PRINT);
// Monitoring
#if HAS_HOTEND
buttonExt1 = lv_big_button_create(scr, "F:/bmp_ext1_state.bin", " ", 55, ICON_POS_Y, event_handler, ID_INFO_EXT);
buttonExt1 = lv_big_button_create(scr, "F:/bmp_ext1_state.bin", " ", 20, ICON_POS_Y, event_handler, ID_INFO_EXT);
#endif
#if HAS_MULTI_HOTEND
buttonExt2 = lv_big_button_create(scr, "F:/bmp_ext2_state.bin", " ", 163, ICON_POS_Y, event_handler, ID_INFO_EXT);
buttonExt2 = lv_big_button_create(scr, "F:/bmp_ext2_state.bin", " ", 180, ICON_POS_Y, event_handler, ID_INFO_EXT);
#endif
#if HAS_HEATED_BED
buttonBedstate = lv_big_button_create(scr, "F:/bmp_bed_state.bin", " ", TERN(HAS_MULTI_HOTEND, 271, 210), ICON_POS_Y, event_handler, ID_INFO_BED);
@ -219,22 +219,22 @@ void lv_temp_refr() {
#if HAS_HOTEND
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(0), thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1, public_buf_l);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
#endif
#if HAS_MULTI_HOTEND
sprintf(public_buf_l, printing_menu.temp1, thermalManager.wholeDegHotend(1), thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2, public_buf_l);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
#endif
#if HAS_HEATED_BED
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
lv_label_set_text(labelBed, public_buf_l);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
#endif
#if HAS_FAN
sprintf_P(public_buf_l, PSTR("%d%%"), (int)thermalManager.fanSpeedPercent(0));
lv_label_set_text(labelFan, public_buf_l);
lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_OUT_BOTTOM_MID, 0, 0);
lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
#endif
}

View File

@ -104,16 +104,16 @@ void lv_draw_tmc_step_mode_settings() {
scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle);
bool stealth_X = false, stealth_Y = false, stealth_Z = false, stealth_E0 = false, stealth_E1 = false;
TERN_(X_HAS_STEALTHCHOP, stealth_X = stepperX.get_stealthChop());
TERN_(Y_HAS_STEALTHCHOP, stealth_Y = stepperY.get_stealthChop());
TERN_(Z_HAS_STEALTHCHOP, stealth_Z = stepperZ.get_stealthChop());
TERN_(X_HAS_STEALTHCHOP, stealth_X = stepperX.get_stealthChop());
TERN_(Y_HAS_STEALTHCHOP, stealth_Y = stepperY.get_stealthChop());
TERN_(Z_HAS_STEALTHCHOP, stealth_Z = stepperZ.get_stealthChop());
TERN_(E0_HAS_STEALTHCHOP, stealth_E0 = stepperE0.get_stealthChop());
TERN_(E1_HAS_STEALTHCHOP, stealth_E1 = stepperE1.get_stealthChop());
if (!uiCfg.para_ui_page) {
buttonXState = lv_screen_menu_item_onoff(scr, machine_menu.X_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_TMC_MODE_X, 0, stealth_X);
buttonYState = lv_screen_menu_item_onoff(scr, machine_menu.Y_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_TMC_MODE_Y, 1, stealth_Y);
buttonZState = lv_screen_menu_item_onoff(scr, machine_menu.Z_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_TMC_MODE_Z, 2, stealth_Z);
buttonXState = lv_screen_menu_item_onoff(scr, machine_menu.X_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_TMC_MODE_X, 0, stealth_X);
buttonYState = lv_screen_menu_item_onoff(scr, machine_menu.Y_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_TMC_MODE_Y, 1, stealth_Y);
buttonZState = lv_screen_menu_item_onoff(scr, machine_menu.Z_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_TMC_MODE_Z, 2, stealth_Z);
buttonE0State = lv_screen_menu_item_onoff(scr, machine_menu.E0_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_TMC_MODE_E0, 2, stealth_E0);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_TMC_MODE_DOWN, true);
}

View File

@ -60,8 +60,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_T_HOME: lv_draw_home(); break;
case ID_T_LEVELING:
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR,(uint8_t *)public_buf_m);
public_buf_m[sizeof(public_buf_m)-1] = 0;
get_gcode_command(AUTO_LEVELING_COMMAND_ADDR, (uint8_t *)public_buf_m);
public_buf_m[sizeof(public_buf_m) - 1] = 0;
queue.inject_P(PSTR(public_buf_m));
#else
uiCfg.leveling_first_time = true;
@ -89,7 +89,7 @@ void lv_draw_tool() {
lv_big_button_create(scr, "F:/bmp_mov.bin", tool_menu.move, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_T_MOV);
lv_big_button_create(scr, "F:/bmp_zero.bin", tool_menu.home, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME);
lv_big_button_create(scr, "F:/bmp_leveling.bin", tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling), INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING);
lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT);
lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_FILAMENT);
lv_big_button_create(scr, "F:/bmp_more.bin", tool_menu.more, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_MORE);
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_T_RETURN);
}

View File

@ -71,9 +71,9 @@ void lv_update_touch_calibration_screen() {
if (calibration_stage < CALIBRATION_SUCCESS) {
// handle current state
switch (calibration_stage) {
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break;
default: break;
}

View File

@ -159,7 +159,7 @@ void gCfgItems_init() {
gCfgItems.spi_flash_flag = FLASH_INF_VALID_FLAG;
W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems));
//init gcode command
// init gcode command
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[0], AUTO_LEVELING_COMMAND_ADDR, 100);
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[1], OTHERS_COMMAND_ADDR_1, 100);
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&custom_gcode_command[2], OTHERS_COMMAND_ADDR_2, 100);
@ -208,7 +208,7 @@ void ui_cfg_init() {
memset(&ipPara, 0, sizeof(ipPara));
strcpy_P(wifiPara.ap_name, PSTR(WIFI_AP_NAME));
strcpy_P(wifiPara.keyCode, PSTR(WIFI_KEY_CODE));
//client
// client
strcpy_P(ipPara.ip_addr, PSTR(IP_ADDR));
strcpy_P(ipPara.mask, PSTR(IP_MASK));
strcpy_P(ipPara.gate, PSTR(IP_GATE));
@ -216,7 +216,7 @@ void ui_cfg_init() {
ipPara.dhcp_flag = IP_DHCP_FLAG;
//AP
// AP
strcpy_P(ipPara.dhcpd_ip, PSTR(AP_IP_ADDR));
strcpy_P(ipPara.dhcpd_mask, PSTR(AP_IP_MASK));
strcpy_P(ipPara.dhcpd_gate, PSTR(AP_IP_GATE));
@ -238,33 +238,33 @@ void update_spi_flash() {
uint8_t command_buf[512];
W25QXX.init(SPI_QUARTER_SPEED);
//read back the gcode command before erase spi flash
// read back the gcode command before erase spi flash
W25QXX.SPI_FLASH_BufferRead((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf));
W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems));
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf));
}
void update_gcode_command(int addr,uint8_t *s) {
void update_gcode_command(int addr, uint8_t *s) {
uint8_t command_buf[512];
W25QXX.init(SPI_QUARTER_SPEED);
//read back the gcode command before erase spi flash
// read back the gcode command before erase spi flash
W25QXX.SPI_FLASH_BufferRead((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf));
W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems));
switch (addr) {
case AUTO_LEVELING_COMMAND_ADDR: memcpy(&command_buf[0*100], s, 100); break;
case OTHERS_COMMAND_ADDR_1: memcpy(&command_buf[1*100], s, 100); break;
case OTHERS_COMMAND_ADDR_2: memcpy(&command_buf[2*100], s, 100); break;
case OTHERS_COMMAND_ADDR_3: memcpy(&command_buf[3*100], s, 100); break;
case OTHERS_COMMAND_ADDR_4: memcpy(&command_buf[4*100], s, 100); break;
case AUTO_LEVELING_COMMAND_ADDR: memcpy(&command_buf[0 * 100], s, 100); break;
case OTHERS_COMMAND_ADDR_1: memcpy(&command_buf[1 * 100], s, 100); break;
case OTHERS_COMMAND_ADDR_2: memcpy(&command_buf[2 * 100], s, 100); break;
case OTHERS_COMMAND_ADDR_3: memcpy(&command_buf[3 * 100], s, 100); break;
case OTHERS_COMMAND_ADDR_4: memcpy(&command_buf[4 * 100], s, 100); break;
default: break;
}
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&command_buf, GCODE_COMMAND_ADDR, sizeof(command_buf));
}
void get_gcode_command(int addr,uint8_t *d) {
void get_gcode_command(int addr, uint8_t *d) {
W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BufferRead((uint8_t *)d, addr, 100);
}
@ -369,14 +369,14 @@ void tft_style_init() {
style_num_text.text.line_space = -5;
lv_style_copy(&style_sel_text, &lv_style_scr);
style_sel_text.body.main_color = LV_COLOR_BACKGROUND;
style_sel_text.body.grad_color = LV_COLOR_BACKGROUND;
style_sel_text.text.color = LV_COLOR_YELLOW;
style_sel_text.text.sel_color = LV_COLOR_YELLOW;
style_sel_text.text.font = TERN(HAS_SPI_FLASH_FONT, &gb2312_puhui32, LV_FONT_DEFAULT);
style_sel_text.line.width = 0;
style_sel_text.text.letter_space = 0;
style_sel_text.text.line_space = -5;
style_sel_text.body.main_color = LV_COLOR_BACKGROUND;
style_sel_text.body.grad_color = LV_COLOR_BACKGROUND;
style_sel_text.text.color = LV_COLOR_YELLOW;
style_sel_text.text.sel_color = LV_COLOR_YELLOW;
style_sel_text.text.font = TERN(HAS_SPI_FLASH_FONT, &gb2312_puhui32, LV_FONT_DEFAULT);
style_sel_text.line.width = 0;
style_sel_text.text.letter_space = 0;
style_sel_text.text.line_space = -5;
lv_style_copy(&style_line, &lv_style_plain);
style_line.line.color = LV_COLOR_MAKE(0x49, 0x54, 0xFF);
style_line.line.width = 1;
@ -624,7 +624,7 @@ char *creat_title_text() {
if (j >= 400) break;
}
for (i = 0; i < 400; i += 2) {
p_index = (uint16_t *)(&bmp_public_buf[i]);
p_index = (uint16_t *)(&bmp_public_buf[i]);
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
}
SPI_TFT.tftio.WriteSequence((uint16_t*)bmp_public_buf, 200);
@ -1353,7 +1353,7 @@ extern volatile uint32_t systick_uptime_millis;
void print_time_count() {
if ((systick_uptime_millis % 1000) == 0)
if (print_time.start == 1) print_time.seconds++;
if (print_time.start == 1) print_time.seconds++;
}
void LV_TASK_HANDLER() {

View File

@ -458,8 +458,8 @@ void tft_style_init();
extern char *creat_title_text();
void preview_gcode_prehandle(char *path);
void update_spi_flash();
void update_gcode_command(int addr,uint8_t *s);
void get_gcode_command(int addr,uint8_t *d);
void update_gcode_command(int addr, uint8_t *s);
void get_gcode_command(int addr, uint8_t *d);
void lv_serial_capt_hook(void *, uint8_t);
void lv_eom_hook(void *);
#if HAS_GCODE_PREVIEW

View File

@ -71,7 +71,7 @@ void lv_draw_wifi() {
if (gCfgItems.wifi_mode_sel == STA_MODEL) {
if (gCfgItems.cloud_enable)
buttonCloud = lv_imgbtn_create(scr, "F:/bmp_cloud.bin", BTN_X_PIXEL+INTERVAL_V*2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_CLOUD);
buttonCloud = lv_imgbtn_create(scr, "F:/bmp_cloud.bin", BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_CLOUD);
buttonReconnect = lv_imgbtn_create(scr, "F:/bmp_wifi.bin", BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RECONNECT);

View File

@ -28,7 +28,7 @@
void lv_draw_wifi_list();
void lv_clear_wifi_list();
void disp_wifi_list();
void cutWifiName(char *name, int len,char *outStr);
void cutWifiName(char *name, int len, char *outStr);
void wifi_scan_handle();
#define NUMBER_OF_PAGE 5

View File

@ -38,7 +38,7 @@ TIPS_DISP tips_disp;
tips_menu_def tips_menu;
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, "");

View File

@ -714,7 +714,7 @@ void disp_assets_update_progress(const char *msg) {
char buf[30];
memset(buf, ' ', COUNT(buf));
strncpy(buf, msg, strlen(msg));
buf[COUNT(buf)-1] = '\0';
buf[COUNT(buf) - 1] = '\0';
disp_string(100, 165, buf, 0xFFFF, 0x0000);
}

View File

@ -265,12 +265,12 @@ const char *bakPath = "_assets";
void spiFlashErase_PIC() {
volatile uint32_t pic_sectorcnt = 0;
W25QXX.init(SPI_QUARTER_SPEED);
//erase 0x001000 -64K
// erase 0x001000 -64K
for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024);
}
//erase 64K -- 6M
// erase 64K -- 6M
for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024);
@ -281,7 +281,7 @@ void spiFlashErase_PIC() {
void spiFlashErase_FONT() {
volatile uint32_t Font_sectorcnt = 0;
W25QXX.init(SPI_QUARTER_SPEED);
for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++) {
for (Font_sectorcnt = 0; Font_sectorcnt < 32 - 1; Font_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
}
@ -565,7 +565,7 @@ void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
tmp_cnt++;
} while (PIC.name[j++] != '\0');
//pic size
// pic size
W25QXX.SPI_FLASH_BufferRead(PIC.size.bytes, PIC_SIZE_ADDR + i * 4, 4);
if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {

View File

@ -55,19 +55,19 @@
#define PIC_MAX_CN 100 // Maximum number of pictures
#define PIC_NAME_MAX_LEN 50 // Picture name maximum length
#define LOGO_MAX_SIZE_TFT35 (300*1024)
#define LOGO_MAX_SIZE_TFT32 (150*1024)
#define TITLELOGO_MAX_SIZE (150*1024) // Little logo maximum
#define DEFAULT_VIEW_MAX_SIZE (200*200*2)
#define FLASH_VIEW_MAX_SIZE (200*200*2)
#define LOGO_MAX_SIZE_TFT35 (300 * 1024)
#define LOGO_MAX_SIZE_TFT32 (150 * 1024)
#define TITLELOGO_MAX_SIZE (150 * 1024) // Little logo maximum
#define DEFAULT_VIEW_MAX_SIZE (200 * 200 * 2)
#define FLASH_VIEW_MAX_SIZE (200 * 200 * 2)
#define PER_PIC_MAX_SPACE_TFT35 (9*1024)
#define PER_PIC_MAX_SPACE_TFT32 (16*1024)
#define PER_FONT_MAX_SPACE (16*1024)
#define PER_PIC_MAX_SPACE_TFT35 (9 * 1024)
#define PER_PIC_MAX_SPACE_TFT32 (16 * 1024)
#define PER_FONT_MAX_SPACE (16 * 1024)
#if SPI_FLASH_SIZE == 0x200000
//pic
//Robin_pro pic addr
// pic
// Robin_pro pic addr
#define PIC_NAME_ADDR 0x001000 // Pic information addr
#define PIC_SIZE_ADDR 0x001800 // Pic size information addr
#define PIC_COUNTER_ADDR 0x002000 // Pic total number
@ -77,8 +77,8 @@
// TFT35
#define DEFAULT_VIEW_ADDR_TFT35 0x1EA070
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35 + 90 * 1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35 + 80 * 1024)
#define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
#define PIC_DATA_ADDR_TFT32 0x00F000
@ -87,11 +87,11 @@
// font
#define FONTINFOADDR 0x150000 // 6M -- font addr
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#define UNIGBK_FLASH_ADDR (FONTINFOADDR + 4096) // 4*1024
#else
//pic
//Robin_pro pic addr
// pic
// Robin_pro pic addr
#define PIC_NAME_ADDR 0x003000 // Pic information addr
#define PIC_SIZE_ADDR 0x007000 // Pic size information addr
#define PIC_COUNTER_ADDR 0x008000 // Pic total number
@ -99,9 +99,9 @@
// TFT35
#define DEFAULT_VIEW_ADDR_TFT35 0xC5800
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35 + 90 * 1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35 + 80 * 1024)
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35 + 350 * 1024) // 0xC5800
// TFT32
#define PIC_DATA_ADDR_TFT32 0x02F000
@ -110,20 +110,20 @@
// font
#define FONTINFOADDR 0x600000 // 6M -- font addr
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
#define UNIGBK_FLASH_ADDR (FONTINFOADDR + 4096) // 4*1024
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR + 180224) // 176*1024
#endif
// Flash flag
#define REFLSHE_FLGA_ADD (0x800000-32)
#define REFLSHE_FLGA_ADD (0x800000 - 32)
// SD card information first addr
#define VAR_INF_ADDR 0x000000
#define FLASH_INF_VALID_FLAG 0x20201118
//Store some gcode commands, such as auto leveling commands
#define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3*1024
// Store some gcode commands, such as auto leveling commands
#define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3 * 1024
#define AUTO_LEVELING_COMMAND_ADDR GCODE_COMMAND_ADDR
#define OTHERS_COMMAND_ADDR_1 AUTO_LEVELING_COMMAND_ADDR + 100
#define OTHERS_COMMAND_ADDR_2 OTHERS_COMMAND_ADDR_1 + 100
@ -155,7 +155,7 @@ typedef struct pic_msg PIC_MSG;
#define FONT_SIZE_xM 2
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize);
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
uint32_t lv_get_pic_addr(uint8_t *Pname);
void get_spi_flash_data(const char *rec_buf, int offset, int size);

View File

@ -55,7 +55,7 @@ void printer_state_polling() {
gcode.process_subcommands_now_P(PSTR("M25"));
//save the position
// save the position
uiCfg.current_x_position_bak = current_position.x;
uiCfg.current_y_position_bak = current_position.y;
uiCfg.current_z_position_bak = current_position.z;

View File

@ -503,7 +503,7 @@
#define TEXT_WIFI_FORGET_EN "Forget Network"
#define TEXT_DISCONECTED_EN "Wi-Fi Connected"
//wifi-list
// wifi-list
#define MAIN_BUILT_EN "Build"
#define MAIN_FILAMENT_EN "Filament"
#define MAIN_SETUP_EN "Setup"
@ -512,7 +512,7 @@
#define FILE_MENU_BUILD_EN "Build"
#define FILE_MENU_MENU_EN " < Menu"
//about
// about
#define ABOUT_TITLE_EN "About"
#define ABOUT_BUILT_MACHINES_EN "Built Machines"
#define ABOUT_SPARK_EN "Spark"
@ -520,52 +520,52 @@
#define ABOUT_SERIAL_NUMBER_EN "Serial Number:"
#define ABOUT_S_NUMBER_EN "DCPLX02KFC6P"
//set
// set
#define SETUP_TITLE_EN "Setup"
#define SETUP_WIFI_EN "Wi-Fi"
#define SETUP_MANUAL_IP_EN "Manual IP"
#define SETUP_WIFI_NOT_CONNECTED_EN "Not Connected"
#define SETUP_WIFI_NETWORK_EN "WiFi_Network"
//build
// build
#define BUILD_TITLE_EN "Build"
#define BUILD_SD_CARD_EN "SD Card"
#define BUILD_USB_DRIVE_EN "USB Drive"
//SD card
// SD card
#define SD_CARD_TITLE_EN "SD Card"
#define SD_CARD_BACK_EN "< Back"
//USB Drive
// USB Drive
#define USB_DRIVE_TITLE_EN "USB Drive"
#define USB_DRIVE_BACK_EN "< Back"
#define FILE_PAGES_EN "%d/%d"
#define FILE_NEXT_PAGE_EN "Next Page"
#define MEDIA_SELECT_TITLE_EN "Select Media"
//BUILD PLATE
// BUILD PLATE
#define PLATE_TITLE_EN "Build Plate"
#define PLATE_BACK_EN "< Back"
#define PLATE_CONFIRM_EN "Confirm >"
#define PLATE_TIPS_EN "Confirm that there is a Clear\nBuild Plate installed in the\nmachine."
//build model
// build model
#define MODEL_TITLE_EN "Build Model"
#define MODEL_START_BUILD_EN "Start Build"
#define MODEL_BACK_EN "< Back"
//building
// building
#define BUILDING_TITLE_EN "Building"
#define BUILDING_MENU_EN "Build Menu"
#define BUILDING_COMPLETED "Build\nComplete"
//building menu
// building menu
#define BUILDING_MENU_TITLE_EN "Build Menu"
#define BUILDING_MENU_SETTINGS_EN "Build Settings"
#define BUILDING_MENU_PAUSE_EN "Pause Build"
#define BUILDING_MENU_CANCEL_EN "Cancel Build"
#define BUILDING_MENU_BACK_EN "< Back"
//build settings
// build settings
#define SETTINGS_TITLE_EN "Build Settings"
#define SETTINGS_NOZZLE_TEMPER_EN "Nozzle Temp:"
#define SETTINGS_NOZZLE_VALUE_EN "%d"
@ -575,13 +575,13 @@
#define SETTINGS_SPEED_VALUE_EN "Standard"
#define SETTINGS_BACK_EN "< Back"
//build paused
// build paused
#define PAUSED_TITLE_EN "Build Paused"
#define PAUSED_RESUME_EN "Resume Build"
#define PAUSED_CANCEL_EN "Cancel Build"
#define PAUSED_BACK_EN "< Back"
//build cancel
// build cancel
#define CANCEL_TITLE_EN "Cancel Build"
#define CANCEL_BUILD_EN "Cancel Build"
#define CANCEL_TIPS_EN "Are you sure you want to\ncancel this build? The model\nwill be deleted from this\nmachine. It will need to be\nresent from your computer\nbefore it can be built in the\nfuture."
@ -589,31 +589,31 @@
#define CANCEL_BUILD_DISPLAY_EN "Build\nCanceled"
#define CANCEL_OVER_PLATE_TIPS_EN "Confirm that the Build Plate\nhas been removed from the\nmachine."
//filament model enter
// filament model enter
#define FILAMENT_MODEL_ENTER_TITLE_EN "Model-PLA"
#define FILAMENT_MODEL_ENTER_BACK_EN "< Back"
#define FILAMENT_MODEL_ENTER_BEGIN_EN "Begin >"
#define FILAMENT_MODEL_ENTER_TIPS_EN "The Model Filament spool\ncompartment is located on\nthe right side of the machine."
//filament model PLA
// filament model PLA
#define FILAMENT_MODEL_PLA_TITLE_EN "Model-PLA"
#define FILAMENT_PLA_LOAD_TITLE_EN "Load Filament"
#define FILAMENT_PLA_UNLOAD_TITLE_EN "Unload Filament"
#define FILAMENT_MODEL_PLA_LOAD_EN "Load Filament"
#define FILAMENT_MODEL_PLA_UNLOAD_EN "Unload Filament"
//filament support enter
// filament support enter
#define FILAMENT_SUPPORT_ENTER_TITLE_EN "Support-PVA"
#define FILAMENT_SUPPORT_ENTER_BACK_EN "< Back"
#define FILAMENT_SUPPORT_ENTER_BEGIN_EN "Begin >"
#define FILAMENT_SUPPORT_ENTER_TIPS_EN "The Support Filament spool\ncompartment is located on\nthe left side of the machine."
//filament heating
// filament heating
#define FILAMENT_HEATING_LOAD_TITLE_EN "Load Filament"
#define FILAMENT_HEATING_UNLOAD_TITLE_EN "Unload Filament"
#define FILAMENT_HEATING_CANCEL_EN "< Cancel"
#define FILAMENT_HEATING_MATERIAL_EN "Material:"
#define FILAMENT_HEATING_PLA_EN "Model-PLA"
#define FILAMENT_HEATING_TIPS_EN "Print head is heating..."
//rotate left
// rotate left
#define ROTATE_LEFT_LOAD_TITLE_EN "Load Filament"
#define ROTATE_LEFT_UNLOAD_TITLE_EN "Unload Filament"
#define ROTATE_LEFT_CANCEL_EN "< Cancel"
@ -622,7 +622,7 @@
#define ROTATE_LEFT_NEXT_EN "Next >"
#define ROTATE_LEFT_TIPS_EN "Rotate extruder selection\ndial to the left."
//hang spool
// hang spool
#define HANG_SPOOL_TITLE_EN "Load Filament"
#define HANG_SPOOL_PREVIOUS_EN "< Previous"
#define HANG_SPOOL_MATERIAL_EN "Material:"
@ -630,7 +630,7 @@
#define HANG_SPOOL_NEXT_EN "Next >"
#define HANG_SPOOL_TIPS_EN "Hang the spool in the spool\ncompartment as shown."
//feed filament
// feed filament
#define FEED_FILAMENT_TITLE_EN "Load Filament"
#define FEED_FILAMENT_PREVIOUS_EN "< Previous"
#define FEED_FILAMENT_MATERIAL_EN "Material:"
@ -638,7 +638,7 @@
#define FEED_FILAMENT_NEXT_EN "Next >"
#define FEED_FILAMENT_TIPS_EN "Feed filament into extruder\nup beyond the gears."
//feed filament
// feed filament
#define ROTATE_UP_TITLE_EN "Load Filament"
#define ROTATE_UP_PREVIOUS_EN "< Previous"
#define ROTATE_UP_MATERIAL_EN "Material:"
@ -646,20 +646,20 @@
#define ROTATE_UP_NEXT_EN "Next >"
#define ROTATE_UP_TIPS_EN "Rotate extruder selection\ndial up."
//filament begin
// filament begin
#define FEED_BEGIN_TITLE_EN "Load Filament"
#define FEED_BEGIN_MATERIAL_EN "Material:"
#define FEED_BEGIN_PLA_EN "Model-PLA"
#define FEED_BEGIN_NEXT_EN "Next >"
#define FEED_BEGIN_TIPS_EN "Press Next when filament\nbegins to extrude."
//filament finish
// filament finish
#define FEED_FINISH_TITLE_EN "Load Filament"
#define FEED_FINISH_MATERIAL_EN "Material:"
#define FEED_FINISH_PLA_EN "Model-PLA"
#define FEED_FINISH_NEXT_EN "Finish >"
#define FEED_FINISH_TIPS_EN "Remove filament from the\nnozzle and discard."
//fiament remove
// fiament remove
#define REMOVE_SPOOL_TITLE_EN "Unload Filament"
#define REMOVE_SPOOL_PREVIOUS_EN "< Previous"
#define REMOVE_SPOOL_FINISH_EN "Finish >"
@ -671,7 +671,7 @@
#define LOAD_FINISH_EN "Load\nFilament\nComplete"
#define UNLOAD_FINISH_EN "Unload\nFilament\nComplete"
//manual ip
// manual ip
#define MANUAL_IP_TITLE_EN "Manual IP"
#define MANUAL_IP_CANCEL_EN "< Cancel"
#define MANUAL_IP_APPLY_EN "Join >"

View File

@ -215,7 +215,7 @@
#define AUTO_SHUTDOWN_RU "авто-откл"
#define MANUAL_SHUTDOWN_RU "ручн-откл"
#define DIALOG_CONFIRM_RU "да"//"подтвердить"
#define DIALOG_CONFIRM_RU "да" // "подтвердить"
#define DIALOG_CANCLE_RU "отмена"
#define DIALOG_OK_RU "да"
#define DIALOG_RESET_RU "сброс"

View File

@ -241,8 +241,7 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
SPI_TFT.setWindow((uint16_t)area->x1, (uint16_t)area->y1, width, height);
for (uint16_t i = 0; i < height; i++)
SPI_TFT.tftio.WriteSequence((uint16_t*)(color_p + width * i), width);
SPI_TFT.tftio.WriteSequence((uint16_t*)color_p, width * height);
lv_disp_flush_ready(disp); // Indicate you are ready with the flushing
@ -333,7 +332,7 @@ bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) {
extern uint8_t currentFlashPage;
//spi_flash
// spi_flash
uint32_t pic_read_base_addr = 0, pic_read_addr_offset = 0;
lv_fs_res_t spi_flash_open_cb (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode) {
static char last_path_name[30];
@ -382,7 +381,7 @@ lv_fs_res_t spi_flash_tell_cb(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p
return LV_FS_RES_OK;
}
//sd
// sd
char *cur_namefff;
uint32_t sd_read_base_addr = 0, sd_read_addr_offset = 0, small_image_size = 409;
lv_fs_res_t sd_open_cb (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode) {

View File

@ -48,7 +48,7 @@ void disp_language_init();
#define MULTI_LANGUAGE_ENABLE 1
#define MULTI_LANGUAGE_DISABLE 0
typedef struct machine_common_disp{
typedef struct machine_common_disp {
const char *default_value;
const char *next;
@ -742,7 +742,7 @@ typedef struct pause_msg_disp {
extern pause_msg_def pause_msg_menu;
typedef struct eeprom_disp{
typedef struct eeprom_disp {
const char *title;
const char *store;
const char *read;

View File

@ -37,7 +37,7 @@ class WifiSerial {
// Set up / tear down
void begin(uint32_t baud);
void begin(uint32_t baud,uint8_t config);
void begin(uint32_t baud, uint8_t config);
void end();
int available(void);
int read(void);
@ -51,13 +51,13 @@ class WifiSerial {
bool isHalfDuplex(void) const;
void enableHalfDuplexRx(void);
private:
void setRx(uint32_t _rx);
void setTx(uint32_t _tx);
void setRx(PinName _rx);
void setTx(PinName _tx);
void init(PinName _rx, PinName _tx);
bool _rx_enabled;
uint8_t _config;
unsigned long _baud;
private:
void setRx(uint32_t _rx);
void setTx(uint32_t _tx);
void setRx(PinName _rx);
void setTx(PinName _tx);
void init(PinName _rx, PinName _tx);
bool _rx_enabled;
uint8_t _config;
unsigned long _baud;
};

View File

@ -68,7 +68,8 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) {
#define disable_timer_if_necessary(dev, ch) NOOP
static void usart_enable_no_irq(usart_dev *usart_device, bool with_irq) {
if (with_irq) usart_enable(usart_device);
if (with_irq)
usart_enable(usart_device);
else {
usart_reg_map *regs = usart_device->regs;
regs->CR1 |= (USART_CR1_TE | USART_CR1_RE); // Preserve word length, etc. Use 'or' to preserve USART_CR1_M_8N1

View File

@ -39,18 +39,18 @@ class WifiSerial {
/* Set up/tear down */
void begin(uint32 baud);
void begin(uint32 baud,uint8_t config);
void begin(uint32 baud, uint8_t config);
void end();
int available();
int read();
int write(uint8_t);
inline void wifi_usart_irq(usart_reg_map *regs) {
/* Handling RXNEIE and TXEIE interrupts.
* RXNE signifies availability of a byte in DR.
*
* See table 198 (sec 27.4, p809) in STM document RM0008 rev 15.
* We enable RXNEIE.
*/
* RXNE signifies availability of a byte in DR.
*
* See table 198 (sec 27.4, p809) in STM document RM0008 rev 15.
* We enable RXNEIE.
*/
if ((regs->CR1 & USART_CR1_RXNEIE) && (regs->SR & USART_SR_RXNE)) {
#ifdef USART_SAFE_INSERT
/* If the buffer is full and the user defines USART_SAFE_INSERT,
@ -63,15 +63,15 @@ class WifiSerial {
}
/* TXE signifies readiness to send a byte to DR. */
if ((regs->CR1 & USART_CR1_TXEIE) && (regs->SR & USART_SR_TXE)) {
if (!rb_is_empty(this->usart_device->wb))
regs->DR=rb_remove(this->usart_device->wb);
else
regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE
if (!rb_is_empty(this->usart_device->wb))
regs->DR = rb_remove(this->usart_device->wb);
else
regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE
}
}
int wifi_rb_is_full();
struct usart_dev *usart_device;
private:
private:
uint8 tx_pin;
uint8 rx_pin;
};

View File

@ -55,13 +55,13 @@
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
extern uint8_t Explore_Disk (char *path , uint8_t recu_level);
extern uint8_t Explore_Disk(char *path, uint8_t recu_level);
extern uint8_t commands_in_queue;
extern uint8_t sel_id;
extern unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick);
extern unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick);
volatile SZ_USART_FIFO WifiRxFifo;
volatile SZ_USART_FIFO WifiRxFifo;
#define WAIT_ESP_TRANS_TIMEOUT_TICK 10500
@ -487,7 +487,7 @@ static bool longName2DosName(const char *longName, char *dosName) {
if (len > UDISKBUFLEN) return 0;
if (wifiDmaRcvFifo.state[tmpW] == udisk_buf_empty) {
const int timeOut = 2000; //millisecond
const int timeOut = 2000; // millisecond
dmaTransmitBegin();
if (HAL_DMA_PollForTransferCustomize(&wifiUsartDMArx, HAL_DMA_FULL_TRANSFER, timeOut) == HAL_OK) {
memcpy((unsigned char *) wifiDmaRcvFifo.bufferAddr[tmpW], (uint8_t *)bufToCpy, len);
@ -612,14 +612,14 @@ int package_to_wifi(WIFI_RET_TYPE type, uint8_t *buf, int len) {
return 0;
}
if (len > 0) {
if (len > 0) {
memcpy(&buf_to_wifi[4 + index_to_wifi], buf, len);
index_to_wifi += len;
if (index_to_wifi < 1)
return 0;
if (buf_to_wifi[index_to_wifi + 3] == '\n') {
if (buf_to_wifi[index_to_wifi + 3] == '\n') {
// mask "wait" "busy" "X:"
if ( ((buf_to_wifi[4] == 'w') && (buf_to_wifi[5] == 'a') && (buf_to_wifi[6] == 'i') && (buf_to_wifi[7] == 't'))
|| ((buf_to_wifi[4] == 'b') && (buf_to_wifi[5] == 'u') && (buf_to_wifi[6] == 's') && (buf_to_wifi[7] == 'y'))
@ -768,7 +768,7 @@ int write_to_file(char *buf, int len) {
if (res == -1) {
ZERO(public_buf);
file_writer.write_index = 0;
return -1;
return -1;
}
return 0;
@ -840,7 +840,7 @@ uint8_t Explore_Disk(char *path , uint8_t recu_level) {
static void wifi_gcode_exec(uint8_t *cmd_line) {
int8_t tempBuf[100] = { 0 };
uint8_t *tmpStr = 0;
int cmd_value;
int cmd_value;
volatile int print_rate;
if (strchr((char *)cmd_line, '\n') && (strchr((char *)cmd_line, 'G') || strchr((char *)cmd_line, 'M') || strchr((char *)cmd_line, 'T'))) {
tmpStr = (uint8_t *)strchr((char *)cmd_line, '\n');
@ -1492,7 +1492,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
memcpy(file_writer.saveFileName, msg + 5, fileNameLen);
utf8_2_unicode(file_writer.saveFileName,fileNameLen);
utf8_2_unicode(file_writer.saveFileName, fileNameLen);
ZERO(public_buf);
@ -1745,7 +1745,7 @@ int32_t readWifiFifo(uint8_t *retBuf, uint32_t bufLen) {
void stopEspTransfer() {
if (wifi_link_state == WIFI_TRANS_FILE)
wifi_link_state = WIFI_CONNECTED;
wifi_link_state = WIFI_CONNECTED;
TERN_(SDSUPPORT, card.closefile());
@ -2015,8 +2015,8 @@ void get_wifi_commands() {
if (gpos) {
switch (strtol(gpos + 1, nullptr, 10)) {
case 0 ... 1:
TERN_(ARC_SUPPORT, case 2 ... 3:)
TERN_(BEZIER_CURVE_SUPPORT, case 5:)
TERN_(ARC_SUPPORT, case 2 ... 3:)
TERN_(BEZIER_CURVE_SUPPORT, case 5:)
SERIAL_ECHOLNPGM(STR_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED);
break;

View File

@ -56,7 +56,7 @@
#define UDISKBUFLEN 1024
typedef enum{
typedef enum {
udisk_buf_empty = 0,
udisk_buf_full,
} UDISK_DATA_BUFFER_STATE;
@ -74,41 +74,41 @@ typedef struct {
typedef struct {
uint8_t flag; // 0x0: no error; 0x01: error
uint32_t start_tick; //error start time
uint32_t start_tick; // error start time
uint32_t now_tick;
} WIFI_TRANS_ERROR;
extern volatile WIFI_TRANS_ERROR wifiTransError;
typedef struct {
char ap_name[32]; //wifi-name
char keyCode[64]; //wifi password
int decodeType;
int baud;
int mode;
char ap_name[32]; // wifi-name
char keyCode[64]; // wifi password
int decodeType;
int baud;
int mode;
} WIFI_PARA;
typedef struct {
char state;
char hostUrl[96];
int port;
int port;
char id[21];
} CLOUD_PARA;
typedef struct {
char dhcp_flag;
char ip_addr[16];
char mask[16];
char gate[16];
char dns[16];
char dhcp_flag;
char ip_addr[16];
char mask[16];
char gate[16];
char dns[16];
char dhcpd_flag;
char dhcpd_ip[16];
char dhcpd_mask[16];
char dhcpd_gate[16];
char dhcpd_dns[16];
char start_ip_addr[16];
char end_ip_addr[16];
char dhcpd_flag;
char dhcpd_ip[16];
char dhcpd_mask[16];
char dhcpd_gate[16];
char dhcpd_dns[16];
char start_ip_addr[16];
char end_ip_addr[16];
} IP_PARA;
typedef enum {
@ -144,8 +144,8 @@ extern volatile TRANSFER_STATE esp_state;
typedef struct {
char buf[20][80];
int rd_index;
int wt_index;
int rd_index;
int wt_index;
} QUEUE;
typedef enum {

View File

@ -36,7 +36,7 @@
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
extern SZ_USART_FIFO WifiRxFifo;
extern SZ_USART_FIFO WifiRxFifo;
extern int readUsartFifo(SZ_USART_FIFO *fifo, int8_t *buf, int32_t len);
extern int writeUsartFifo(SZ_USART_FIFO * fifo, int8_t * buf, int32_t len);
@ -301,7 +301,7 @@ EspUploadResult readPacket(uint8_t op, uint32_t *valp, size_t *bodyLen, uint32_t
return stat;
}
else if (state == header) {
//store the header byte
// store the header byte
hdr[hdrIdx++] = c;
if (hdrIdx >= headerLength) {
// get the body length, prepare a buffer for it
@ -423,7 +423,7 @@ EspUploadResult doCommand(uint8_t op, const uint8_t *data, size_t dataLen, uint3
EspUploadResult Sync(uint16_t timeout) {
uint8_t buf[36];
EspUploadResult stat;
int i ;
int i;
// compose the data for the sync attempt
memset(buf, 0x55, sizeof(buf));
@ -449,8 +449,8 @@ EspUploadResult Sync(uint16_t timeout) {
if (rc != success || bodyLen != 2) break;
}
}
//DEBUG
//else debug//printf("stat=%d\n", (int)stat);
// DEBUG
//else printf("stat=%d\n", (int)stat);
return stat;
}