Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MKS Robin Nano v3 WiFi module (TFT_LVGL_UI) #22109

Merged
merged 27 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa595f5
Merge pull request #1 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 11, 2020
d5d325c
Merge pull request #2 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 13, 2020
d8d5c0f
Merge pull request #4 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 14, 2020
a1055dd
Merge pull request #6 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 18, 2020
8b349b1
Merge pull request #7 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 22, 2020
8c42e50
Merge pull request #14 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jun 27, 2020
626ed70
Merge pull request #15 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jul 1, 2020
80a2552
Merge pull request #16 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jul 2, 2020
8386fdf
Merge pull request #54 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jun 11, 2021
3034d86
mks robin nano v3 add function of wifi
MKS-Sean Jun 11, 2021
8975478
Update irq_overrid.cpp
thinkyhead Jun 11, 2021
5708db5
Fix the header file path
MKS-Sean Jun 12, 2021
321a2fa
Update printer_operation.cpp
thinkyhead Jun 13, 2021
523f2db
split up wifiserial
thinkyhead Jun 13, 2021
25a582f
Add STM32 test
thinkyhead Jun 14, 2021
7b91ec3
split up headers by platform
thinkyhead Jun 14, 2021
ee3599d
Indicate Maple target
thinkyhead Jun 14, 2021
f1a25f2
Merge 'bugfix-2.0.x' into pr/22109
thinkyhead Jun 24, 2021
f5f59cd
Fix #endif comments
thinkyhead Jun 24, 2021
a338b70
Tweak some #ifdefs
thinkyhead Jun 24, 2021
7491014
apply some PSTR
thinkyhead Jun 24, 2021
e1a2286
tweak wifi ticks
thinkyhead Jun 24, 2021
c347ebd
Simplify MKS custom filament check
thinkyhead Jun 24, 2021
c226226
Tweak MKS hardware test
thinkyhead Jun 24, 2021
724c688
Merge pull request #58 from MarlinFirmware/bugfix-2.0.x
solawc Jul 12, 2021
22b5de0
Allow for no hotend / fan
thinkyhead Jul 13, 2021
5e38f79
Use delay() instead of loop
thinkyhead Jul 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,13 +1145,6 @@ void setup() {
#endif
#endif

#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
mks_esp_wifi_init();
WIFISERIAL.begin(WIFI_BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
while (/*!WIFISERIAL && */PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif

TERN_(DYNAMIC_VECTORTABLE, hook_cpu_exceptions()); // If supported, install Marlin exception handlers at runtime

SETUP_RUN(HAL_init());
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/mks_ui/draw_printing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ static lv_obj_t *scr;
static lv_obj_t *labelExt1, *labelFan, *labelZpos, *labelTime;
static lv_obj_t *labelPause, *labelStop, *labelOperat;
static lv_obj_t *bar1, *bar1ValueText;
static lv_obj_t *buttonPause, *buttonOperat, *buttonStop, *buttonExt1, *buttonExt2, *buttonBedstate, *buttonFanstate, *buttonZpos;
static lv_obj_t *buttonPause, *buttonOperat, *buttonStop, *buttonExt1, *buttonFanstate, *buttonZpos;

#if ENABLED(HAS_MULTI_EXTRUDER)
static lv_obj_t *labelExt2;
static lv_obj_t *buttonExt2;
#endif

#if HAS_HEATED_BED
static lv_obj_t* labelBed;
static lv_obj_t* buttonBedstate;
#endif

enum {
Expand Down
89 changes: 29 additions & 60 deletions Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@

extern lv_group_t* g;
static lv_obj_t *scr;
static lv_obj_t *labelExt1, *labelExt1Target, *labelFan;
static lv_obj_t *buttonExt1, *labelExt1, *buttonFanstate, *labelFan;

#if HAS_MULTI_EXTRUDER
static lv_obj_t *labelExt2, *labelExt2Target;
#if ENABLED(HAS_MULTI_EXTRUDER)
static lv_obj_t *labelExt2;
static lv_obj_t *buttonExt2;
#endif

#if HAS_HEATED_BED
static lv_obj_t *labelBed, *labelBedTarget;
static lv_obj_t* labelBed;
static lv_obj_t* buttonBedstate;
#endif

#if ENABLED(MKS_TEST)
Expand Down Expand Up @@ -178,72 +180,35 @@ 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, 180, event_handler, ID_TOOL);
lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 180, event_handler, ID_SET);
lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 180, event_handler, ID_PRINT);
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);

// Monitoring
lv_obj_t *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", " ", 55, ICON_POS_Y, event_handler, ID_INFO_EXT);
#if HAS_MULTI_EXTRUDER
lv_obj_t *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", " ", 163, ICON_POS_Y, event_handler, ID_INFO_EXT);
#if HAS_HEATED_BED
lv_obj_t *buttonBedstate = lv_big_button_create(scr, "F:/bmp_bed_state.bin", " ", 271, ICON_POS_Y, event_handler, ID_INFO_BED);
buttonBedstate = lv_big_button_create(scr, "F:/bmp_bed_state.bin", " ", 271, ICON_POS_Y, event_handler, ID_INFO_BED);
#endif
#else
#if HAS_HEATED_BED
lv_obj_t *buttonBedstate = lv_big_button_create(scr, "F:/bmp_bed_state.bin", " ", 210, ICON_POS_Y, event_handler, ID_INFO_BED);
buttonBedstate = lv_big_button_create(scr, "F:/bmp_bed_state.bin", " ", 210, ICON_POS_Y, event_handler, ID_INFO_BED);
#endif
#endif

lv_obj_t *buttonFanstate = lv_big_button_create(scr, "F:/bmp_fan_state.bin", " ", 380, ICON_POS_Y, event_handler, ID_INFO_FAN);

labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);
labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);

#if HAS_MULTI_EXTRUDER
labelExt2 = lv_label_create(scr, 163, LABEL_MOD_Y, nullptr);
labelExt2Target = lv_label_create(scr, 163, LABEL_MOD_Y, nullptr);
#if HAS_HEATED_BED
labelBed = lv_label_create(scr, 271, LABEL_MOD_Y, nullptr);
labelBedTarget = lv_label_create(scr, 271, LABEL_MOD_Y, nullptr);
#endif
#else
#if HAS_HEATED_BED
labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
#endif
#endif

labelFan = lv_label_create(scr, 380, 80, nullptr);

itoa(thermalManager.degHotend(0), buf, 10);
lv_label_set_text(labelExt1, buf);
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
lv_label_set_text(labelExt1Target, buf);
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
buttonFanstate = lv_big_button_create(scr, "F:/bmp_fan_state.bin", " ", 380, ICON_POS_Y, event_handler, ID_INFO_FAN);

labelExt1 = lv_label_create_empty(scr);
#if HAS_MULTI_EXTRUDER
itoa(thermalManager.degHotend(1), buf, 10);
lv_label_set_text(labelExt2, buf);
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
lv_label_set_text(labelExt2Target, buf);
lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
labelExt2 = lv_label_create_empty(scr);
#endif

#if HAS_HEATED_BED
itoa(thermalManager.degBed(), buf, 10);
lv_label_set_text(labelBed, buf);
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
lv_label_set_text(labelBedTarget, buf);
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
labelBed = lv_label_create_empty(scr);
#endif
labelFan = lv_label_create_empty(scr);

sprintf_P(buf, PSTR("%d%%"), (int)thermalManager.fanSpeedPercent(0));
lv_label_set_text(labelFan, buf);
lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
lv_temp_refr();
}

#if ENABLED(TOUCH_SCREEN_CALIBRATION)
Expand All @@ -256,18 +221,22 @@ void lv_draw_ready_print() {
}

void lv_temp_refr() {
#if HAS_HEATED_BED
sprintf(public_buf_l, printing_menu.bed_temp, thermalManager.wholeDegBed(), thermalManager.degTargetBed());
lv_label_set_text(labelBed, public_buf_l);
#endif

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);
#if HAS_MULTI_EXTRUDER
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);
#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);
#endif
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);
}

void lv_clear_ready_print() {
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/lcd/extui/mks_ui/irq_overrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "tft_lvgl_configuration.h"

#ifdef __STM32F1__

#if ENABLED(MKS_WIFI_MODULE)

#include "draw_ui.h"
Expand Down Expand Up @@ -57,4 +59,5 @@ void __irq_usart1() {
#endif

#endif // MKS_WIFI_MODULE
#endif // __STM32F1__
#endif // HAS_TFT_LVGL_UI
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/mks_ui/printer_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ void filament_pin_setup() {
}

void filament_check() {
const int FIL_DELAY = 20;
#if (PIN_EXISTS(MT_DET_1) || PIN_EXISTS(MT_DET_2) || PIN_EXISTS(MT_DET_3))
const int FIL_DELAY = 20;
#endif
#if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0;
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
Expand Down
26 changes: 21 additions & 5 deletions Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ XPT2046 touch;
#include "../../../feature/powerloss.h"
#endif

#if HAS_SERVOS
#include "../../../../module/servo.h"
rhapsodyv marked this conversation as resolved.
Show resolved Hide resolved
#endif

#if EITHER(PROBE_TARE, HAS_Z_SERVO_PROBE)
#include "../../../../module/probe.h"
rhapsodyv marked this conversation as resolved.
Show resolved Hide resolved
#endif

#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../../tft_io/touch_calibration.h"
#include "draw_touch_calibration.h"
Expand Down Expand Up @@ -193,8 +201,12 @@ void tft_lvgl_init() {
filament_pin_setup();
lv_encoder_pin_init();

TERN_(MKS_WIFI_MODULE, mks_wifi_firmware_update());

#if ENABLED(MKS_WIFI_MODULE)
mks_esp_wifi_init();
mks_wifi_firmware_update();
#endif
TERN_(HAS_SERVOS, servo_init());
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
bool ready = true;
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.load();
Expand All @@ -207,9 +219,13 @@ void tft_lvgl_init() {

uiCfg.print_state = REPRINTING;

strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
card.printLongPath(public_buf_m);
strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[0]));
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
card.printLongPath(public_buf_m);
strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[0]));
#else
strncpy(list_file.long_name[sel_id], recovery.info.sd_filename, sizeof(list_file.long_name[0]));
#endif
lv_draw_printing();
}
#endif
Expand Down
Loading