Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
solawc committed May 16, 2022
1 parent a435f2d commit f88d0e3
Show file tree
Hide file tree
Showing 16 changed files with 188 additions and 53 deletions.
26 changes: 13 additions & 13 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
#define SERIAL_PORT -1
#define SERIAL_PORT 3

/**
* Serial Port Baud Rate
Expand Down Expand Up @@ -192,19 +192,19 @@

// This defines the number of extruders
// :[0, 1, 2, 3, 4, 5, 6, 7, 8]
#define EXTRUDERS 1
#define EXTRUDERS 2

// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75

// For Cyclops or any "multi-extruder" that shares a single nozzle.
// #define SINGLENOZZLE
#define SINGLENOZZLE

// Save and restore temperature and fan speed on tool-change.
// Set standby for the unselected tool with M104/106/109 T...
#if ENABLED(SINGLENOZZLE)
//#define SINGLENOZZLE_STANDBY_TEMP
//#define SINGLENOZZLE_STANDBY_FAN
#define SINGLENOZZLE_STANDBY_TEMP
#define SINGLENOZZLE_STANDBY_FAN
#endif

/**
Expand Down Expand Up @@ -737,8 +737,8 @@
* details can be tuned in Configuration_adv.h
*/

// #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
// #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
#define THERMAL_PROTECTION_COOLER // Enable thermal protection for the laser cooling

Expand Down Expand Up @@ -861,9 +861,9 @@
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
//#define X_DRIVER_TYPE A4988
//#define Y_DRIVER_TYPE A4988
//#define Z_DRIVER_TYPE A4988
#define X_DRIVER_TYPE TMC2209
#define Y_DRIVER_TYPE TMC2209
#define Z_DRIVER_TYPE TMC2209
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
Expand All @@ -872,8 +872,8 @@
//#define I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_DRIVER_TYPE A4988
//#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE TMC2209
#define E1_DRIVER_TYPE TMC2209
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988
Expand Down Expand Up @@ -1070,7 +1070,7 @@
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
* (e.g., an inductive probe or a nozzle-based probe-switch.)
*/
//#define FIX_MOUNTED_PROBE
// #define FIX_MOUNTED_PROBE

/**
* Use the nozzle as the probe, as with a conductive
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@
#define VOLUME_SD_ONBOARD 1
#define VOLUME_USB_FLASH_DRIVE 2
#define DEFAULT_VOLUME SV_SD_ONBOARD
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
#define DEFAULT_SHARED_VOLUME SV_SD_ONBOARD//SV_USB_FLASH_DRIVE
#endif

#endif // SDSUPPORT
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,9 @@ void setup() {
#if ENABLED(MULTI_VOLUME)
card.changeMedia(&card.media_driver_sdcard);
#endif
if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts

// if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts

#endif
SETUP_RUN(tft_lvgl_init());
#endif
Expand All @@ -1592,7 +1594,6 @@ void setup() {
#endif

marlin_state = MF_RUNNING;

SETUP_LOG("setup() completed.");
}

Expand Down
43 changes: 39 additions & 4 deletions Marlin/src/lcd/extui/mks_ui/draw_encoder_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@
extern lv_group_t *g;
static lv_obj_t *scr;
static lv_obj_t *buttonEncoderState = nullptr;
static lv_obj_t *labelEncoderState = nullptr;

static void encoder_disp_update(void);

enum {
ID_ENCODER_RETURN = 1,
ID_ENCODER_STATE
ID_ENCODER_STATE,
ID_ENCODER_NONE
};



static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
Expand All @@ -49,16 +55,45 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break;
case ID_ENCODER_STATE:
gCfgItems.encoder_enable ^= true;
lv_screen_menu_item_onoff_update(buttonEncoderState, gCfgItems.encoder_enable);
// lv_screen_menu_item_onoff_update(buttonEncoderState, gCfgItems.encoder_enable);
encoder_disp_update();
update_spi_flash();
break;
}
}

static lv_obj_t* set_on_off_label(lv_obj_t *labelValue, lv_obj_t *btn, bool curValue) {
labelValue = lv_label_create_empty(btn);
lv_label_set_text(labelValue, curValue ? machine_menu.enable : machine_menu.disable);
lv_obj_align(labelValue, btn, LV_ALIGN_CENTER, 0, 0);
return labelValue;
}

void lv_draw_encoder_settings() {
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);
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);
// 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_screen_menu_item_w(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_NONE, 0, false);

buttonEncoderState = lv_imgbtn_create(scr,
gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin",
PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V,
event_handler,
ID_ENCODER_STATE);

labelEncoderState = set_on_off_label(labelEncoderState, buttonEncoderState, 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);
}

static void encoder_disp_update(void) {

lv_imgbtn_set_src_both(buttonEncoderState, gCfgItems.encoder_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin");
lv_label_set_text(labelEncoderState, gCfgItems.encoder_enable ? machine_menu.enable : machine_menu.disable);
}

void lv_clear_encoder_settings() {
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/extui/mks_ui/draw_level_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_auto_level_offset_settings();
break;
#endif
#if ENABLED(BLTOUCH)
// #if ENABLED(BLTOUCH)
#if ANY(BLTOUCH, FIX_MOUNTED_PROBE)
case ID_LEVEL_BLTOUCH:
last_disp_state = LEVELING_PARA_UI;
lv_clear_level_settings();
Expand All @@ -79,7 +80,7 @@ void lv_draw_level_settings() {
lv_screen_menu_item(scr, machine_menu.LevelingAutoZoffsetConf, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_LEVEL_ZOFFSET, 2);
#endif

#if ENABLED(BLTOUCH)
#if ANY(BLTOUCH, FIX_MOUNTED_PROBE)
lv_screen_menu_item(scr, machine_menu.BLTouchLevelingConf, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_LEVEL_BLTOUCH, 3);
#endif

Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/extui/mks_ui/draw_motor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ void lv_draw_motor_settings() {
int index = 0;

scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle);

lv_screen_menu_item(scr, machine_menu.StepsConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MOTOR_STEPS, index++);

#if USE_SENSORLESS
lv_screen_menu_item(scr, machine_menu.HomingSensitivityConf, PARA_UI_POS_X, PARA_UI_POS_Y * (index + 1), event_handler, ID_HOME_SENSE, index);
index++;
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_P_ADD: {
if (uiCfg.curTempType == 0) {

#if ANY(WATCH_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE)
// #if ANY(WATCH_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE)
int16_t max_target;
#endif
// #endif

thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
#ifdef WATCH_TEMP_INCREASE
Expand All @@ -79,10 +79,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
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);
#endif

}
else {
#if HAS_HEATED_BED
Expand Down Expand Up @@ -120,7 +121,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break;
case ID_P_TYPE:
if (uiCfg.curTempType == 0) {
if (ENABLED(HAS_MULTI_EXTRUDER)) {
if (ENABLED(HAS_MULTI_EXTRUDER) && (DISABLED(SINGLENOZZLE))) {
if (uiCfg.extruderIndex == 0) {
uiCfg.extruderIndex = 1;
}
Expand Down Expand Up @@ -270,7 +271,8 @@ void disp_ext_heart() {

void disp_temp_type() {
if (uiCfg.curTempType == 0) {
if (uiCfg.extruderIndex == 1) {

if (uiCfg.extruderIndex == 1 && (DISABLED(SINGLENOZZLE))) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2);
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
#include "mks_hardware.h"
#include <stdio.h>

#define ICON_POS_Y 260
#define TARGET_LABEL_MOD_Y -36
#define LABEL_MOD_Y 30
#define ICON_POS_Y 260
#define TARGET_LABEL_MOD_Y -36
#define LABEL_MOD_Y 30

extern lv_group_t* g;
#ifndef USE_NEW_LVGL_CONF
Expand Down
Loading

0 comments on commit f88d0e3

Please sign in to comment.