More Improvements for Hibiscus/Quiver

- Implemented more UI touch controls (Z offsets, steps/mm, restore failsafe).
- Fix to lightweight UI when using dual nozzles
master
Marcio Teixeira 7 years ago
parent ac437fdd54
commit daaacf7519

@ -755,9 +755,9 @@ void CLCD::DLCache::append() {
#else #else
Serial.print(F("Appending to DL from RAMG cache, bytes: ")); Serial.print(F("Appending to DL from RAMG cache, bytes: "));
Serial.print(dl_size); Serial.print(dl_size);
Serial.print(" (REG_CMD_DL: "); Serial.print(F(" (REG_CMD_DL: "));
Serial.print(Mem_Read32(REG_CMD_DL)); Serial.print(Mem_Read32(REG_CMD_DL));
Serial.println(")"); Serial.println(F(")"));
#endif #endif
#endif #endif
} }
@ -880,19 +880,29 @@ void CLCD::Init (void) {
/******************* SOUND HELPER CLASS ************************/ /******************* SOUND HELPER CLASS ************************/
/* tiny_interval() downsamples a 32-bit millis() value
into a 8-bit value which can record periods of
up to 4.096 seconds with a rougly 16 millisecond
resolution. This allows us to measure small
intervals without needing to use four-byte counters.
*/
inline uint8_t tiny_interval(uint32_t ms) {
return uint8_t(ms / 64);
}
class CLCD::SoundPlayer { class CLCD::SoundPlayer {
public: public:
struct sound_t { struct sound_t {
effect_t effect; // The sound effect number effect_t effect; // The sound effect number
note_t note; // The MIDI note value note_t note; // The MIDI note value
uint8_t sixteenths; // Duration of note, in sixteeths of a second, or zero to play to completion uint16_t sixteenths; // Duration of note, in sixteeths of a second, or zero to play to completion
}; };
const uint8_t WAIT = 0; const uint8_t WAIT = 0;
private: private:
const sound_t *sequence; const sound_t *sequence;
uint32_t next; uint8_t next;
public: public:
static void setVolume(uint8_t volume); static void setVolume(uint8_t volume);
@ -924,7 +934,7 @@ void CLCD::SoundPlayer::play(effect_t effect, note_t note) {
void CLCD::SoundPlayer::play(const sound_t* seq) { void CLCD::SoundPlayer::play(const sound_t* seq) {
sequence = seq; sequence = seq;
next = 0; next = tiny_interval(millis()) + 1;
} }
bool CLCD::SoundPlayer::soundPlaying() { bool CLCD::SoundPlayer::soundPlaying() {
@ -934,12 +944,13 @@ bool CLCD::SoundPlayer::soundPlaying() {
void CLCD::SoundPlayer::onIdle() { void CLCD::SoundPlayer::onIdle() {
if(!sequence) return; if(!sequence) return;
const bool readyForNextNote = (next == WAIT) ? !soundPlaying() : (millis() > next); const uint8_t tiny_millis = tiny_interval(millis());
const bool readyForNextNote = (next == WAIT) ? !soundPlaying() : (tiny_millis > next);
if(readyForNextNote) { if(readyForNextNote) {
const effect_t fx = effect_t(pgm_read_byte_near(&sequence->effect)); const effect_t fx = effect_t(pgm_read_byte_near(&sequence->effect));
const note_t nt = note_t(pgm_read_byte_near(&sequence->note)); const note_t nt = note_t(pgm_read_byte_near(&sequence->note));
const uint32_t ms = uint32_t(pgm_read_byte_near(&sequence->sixteenths)) * 1000 / 16; const uint16_t ms = uint32_t(pgm_read_byte_near(&sequence->sixteenths)) * 1000 / 16;
if(ms == 0 && fx == SILENCE && nt == 0) { if(ms == 0 && fx == SILENCE && nt == 0) {
sequence = 0; sequence = 0;
@ -949,7 +960,7 @@ void CLCD::SoundPlayer::onIdle() {
SERIAL_PROTOCOLLNPAIR("Scheduling note in ", ms); SERIAL_PROTOCOLLNPAIR("Scheduling note in ", ms);
#endif #endif
#endif #endif
next = (ms == WAIT) ? 0 : (millis() + ms); next = (ms == WAIT) ? 0 : (tiny_millis + tiny_interval(ms));
play(fx, (nt == 0) ? NOTE_C4 : nt); play(fx, (nt == 0) ? NOTE_C4 : nt);
sequence++; sequence++;
} }

@ -22,13 +22,10 @@
// To save MCU RAM, the status message is "baked" in to the status screen // To save MCU RAM, the status message is "baked" in to the status screen
// cache, so we reserve a large chunk of memory for the DL cache // cache, so we reserve a large chunk of memory for the DL cache
#define RAMG_STATUS_SCREEN_DL_SIZE 2048 #define STATUS_SCREEN_DL_SIZE 2048
#define CONFIRMATION_SCREEN_DL_SIZE 2048
static float marlin_x_steps = 100; #define N_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
static float marlin_y_steps = 100;
static float marlin_z_steps = 100;
static float marlin_e0_steps = 100;
static float marlin_z_offset = 0.150;
/**************************** GRID LAYOUT MACROS **************************/ /**************************** GRID LAYOUT MACROS **************************/
@ -120,6 +117,24 @@ class KillScreen {
static void show(progmem_str msg); static void show(progmem_str msg);
}; };
class ConfirmationScreen : public UIScreen {
protected:
static void onEntry();
static void show(const progmem_str message[], size_t lines, progmem_str btn1, progmem_str btn2 );
static bool onTouchStart(uint8_t tag);
public:
static void onRefresh();
};
class RestoreFailsafeScreen : public ConfirmationScreen {
protected:
static void showCompletion();
public:
static void onEntry();
static bool onTouchStart(uint8_t tag);
};
class StatusScreen : public UIScreen { class StatusScreen : public UIScreen {
private: private:
static void static_axis_position(); static void static_axis_position();
@ -242,6 +257,7 @@ class FilesScreen : public UIScreen {
SCREEN_TABLE { SCREEN_TABLE {
DECL_SCREEN(BootScreen), DECL_SCREEN(BootScreen),
DECL_SCREEN(AboutScreen), DECL_SCREEN(AboutScreen),
DECL_SCREEN(RestoreFailsafeScreen),
DECL_SCREEN(CalibrationScreen), DECL_SCREEN(CalibrationScreen),
DECL_SCREEN(StatusScreen), DECL_SCREEN(StatusScreen),
DECL_SCREEN(MenuScreen), DECL_SCREEN(MenuScreen),
@ -265,6 +281,7 @@ SCREEN_TABLE_POST
enum { enum {
STATUS_SCREEN_CACHE, STATUS_SCREEN_CACHE,
MENU_SCREEN_CACHE, MENU_SCREEN_CACHE,
CONFIRMATION_SCREEN_CACHE,
ADVANCED_SETTINGS_SCREEN_CACHE, ADVANCED_SETTINGS_SCREEN_CACHE,
MOVE_AXIS_SCREEN_CACHE, MOVE_AXIS_SCREEN_CACHE,
TEMPERATURE_SCREEN_CACHE, TEMPERATURE_SCREEN_CACHE,
@ -409,6 +426,106 @@ bool AboutScreen::onTouchStart(uint8_t tag) {
} }
} }
/**************************** GENERIC CONFIRMATION SCREEN ****************************/
void ConfirmationScreen::onEntry() {
progmem_str lines[] = {
F("Are you sure?")
};
ConfirmationScreen::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
}
void ConfirmationScreen::show(const progmem_str lines[], size_t n_lines, progmem_str btn1, progmem_str btn2 ) {
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
CLCD::CommandFifo cmd;
cmd.Cmd(CMD_DLSTART);
cmd.Cmd_Clear_Color(Theme::about_bg);
cmd.Cmd_Clear(1,1,1);
#define GRID_COLS 2
#define GRID_ROWS 8
for(uint8_t line = 0; line < n_lines; line++) {
BTX( BTN_POS(1,3-n_lines/2+line), BTN_SIZE(2,1), lines[line], FONT_LRG);
}
if(btn1 && btn2) {
BTN_TAG(1) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(1,1), btn1, MENU_BTN_STYLE);
BTN_TAG(2) THEME(about_btn) BTN( BTN_POS(2,8), BTN_SIZE(1,1), btn2, MENU_BTN_STYLE);
} else if(btn1) {
BTN_TAG(1) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn1, MENU_BTN_STYLE);
} else if(btn2) {
BTN_TAG(2) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn2, MENU_BTN_STYLE);
}
cmd.Cmd(DL_DISPLAY);
cmd.Cmd(CMD_SWAP);
cmd.Cmd_Execute();
if(!dlcache.store(CONFIRMATION_SCREEN_DL_SIZE)) {
#if defined (SERIAL_PROTOCOLLNPAIR)
SERIAL_PROTOCOLLN("Unable to set the confirmation message, not enough DL cache space");
#else
#if defined(UI_FRAMEWORK_DEBUG)
Serial.print(F("Unable to set the confirmation message, not enough DL cache space"));
#endif
#endif
}
}
void ConfirmationScreen::onRefresh() {
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
CLCD::CommandFifo cmd;
cmd.Cmd(CMD_DLSTART);
if(dlcache.hasData()) {
dlcache.append();
}
cmd.Cmd(DL_DISPLAY);
cmd.Cmd(CMD_SWAP);
cmd.Cmd_Execute();
}
bool ConfirmationScreen::onTouchStart(uint8_t tag) {
switch(tag) {
case 1: GOTO_PREVIOUS(); return true;
case 2: GOTO_PREVIOUS(); return true;
}
}
/**************************** RESTORE FAILSAFE SCREEN ***************************/
void RestoreFailsafeScreen::onEntry() {
progmem_str lines[] = {
F("Are you sure?"),
F("Customizations will be lost.")
};
ConfirmationScreen::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
}
void RestoreFailsafeScreen::showCompletion() {
progmem_str lines[] = {
F("Default settings restored.")
};
sound.play(c_maj_arpeggio);
ConfirmationScreen::show(lines, N_ELEMENTS(lines), 0, F("Okay"));
}
bool RestoreFailsafeScreen::onTouchStart(uint8_t tag) {
switch(tag) {
case 1:
EXEC_GCODE(F("M502\nM500"));
showCompletion();
return true;
default:
ConfirmationScreen::onTouchStart(tag);
}
}
/************************************ KILL SCREEN *******************************/ /************************************ KILL SCREEN *******************************/
// The kill screen is an oddball that happens after Marlin has killed the events // The kill screen is an oddball that happens after Marlin has killed the events
@ -706,12 +823,14 @@ void StatusScreen::setStatusMessage(const char * const message) {
static_interaction_buttons(); static_interaction_buttons();
static_status_message(message); static_status_message(message);
if(!dlcache.store(RAMG_STATUS_SCREEN_DL_SIZE)) { if(!dlcache.store(STATUS_SCREEN_DL_SIZE)) {
#if defined (SERIAL_PROTOCOLLNPAIR) #if defined (SERIAL_PROTOCOLLNPAIR)
SERIAL_PROTOCOLLNPAIR("Unable to set the status message, not enough DL cache space: ",message); SERIAL_PROTOCOLLNPAIR("Unable to set the status message, not enough DL cache space: ",message);
#else #else
Serial.print(F("Unable to set the status message, not enough DL cache space: ")); #if defined(UI_FRAMEWORK_DEBUG)
Serial.println(message); Serial.print(F("Unable to set the status message, not enough DL cache space: "));
Serial.println(message);
#endif
#endif #endif
} }
} }
@ -870,20 +989,20 @@ void AdvancedSettingsScreen::onRefresh() {
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,2), F("Z Offset "), MENU_BTN_STYLE); BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,2), F("Z Offset "), MENU_BTN_STYLE);
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,2), F("Steps/mm"), MENU_BTN_STYLE); BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,2), F("Steps/mm"), MENU_BTN_STYLE);
BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE); BTN_TAG(5) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE); BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
BTN_TAG(8) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE); BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
BTN_TAG(5) THEME(menu_btn) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Restore Failsafe"), MENU_BTN_STYLE); BTN_TAG(8) THEME(menu_btn) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Restore Failsafe"), MENU_BTN_STYLE);
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,6), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE); BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,6), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE);
BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,6), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE); BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,6), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
#else #else
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Z Offset "), MENU_BTN_STYLE); BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Z Offset "), MENU_BTN_STYLE);
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Steps/mm"), MENU_BTN_STYLE); BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Steps/mm"), MENU_BTN_STYLE);
BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE); BTN_TAG(5) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE); BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
BTN_TAG(8) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE); BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
BTN_TAG(5) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Restore Failsafe"), MENU_BTN_STYLE); BTN_TAG(8) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Restore Failsafe"), MENU_BTN_STYLE);
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,4), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE); BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,4), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE);
BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE); BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
@ -899,10 +1018,11 @@ void AdvancedSettingsScreen::onRefresh() {
bool AdvancedSettingsScreen::onTouchStart(uint8_t tag) { bool AdvancedSettingsScreen::onTouchStart(uint8_t tag) {
switch(tag) { switch(tag) {
case 1: GOTO_PREVIOUS(); break; case 1: GOTO_PREVIOUS(); break;
case 2: GOTO_PREVIOUS(); break; case 2: GOTO_PREVIOUS(); break;
case 3: GOTO_SCREEN(ZOffsetScreen); break; case 3: GOTO_SCREEN(ZOffsetScreen); break;
case 4: GOTO_SCREEN(StepsScreen); break; case 4: GOTO_SCREEN(StepsScreen); break;
case 8: GOTO_SCREEN(RestoreFailsafeScreen); break;
default: default:
return false; return false;
} }
@ -920,7 +1040,6 @@ void CalibrationScreen::onRefresh() {
cmd.Cmd_Clear_Color(Theme::background); cmd.Cmd_Clear_Color(Theme::background);
cmd.Cmd_Clear(1,1,1); cmd.Cmd_Clear(1,1,1);
#if defined(LCD_PORTRAIT) #if defined(LCD_PORTRAIT)
BTX( BTN_POS(1,8), BTN_SIZE(4,1), F("Touch the dots"), FONT_LRG); BTX( BTN_POS(1,8), BTN_SIZE(4,1), F("Touch the dots"), FONT_LRG);
BTX( BTN_POS(1,9), BTN_SIZE(4,1), F("to calibrate"), FONT_LRG); BTX( BTN_POS(1,9), BTN_SIZE(4,1), F("to calibrate"), FONT_LRG);
@ -979,12 +1098,12 @@ void CalibrationRegistersScreen::onRefresh() {
THEME(transformVal) BTN( BTN_POS(2,5), BTN_SIZE(1,1), F(""), 28, OPT_FLAT); THEME(transformVal) BTN( BTN_POS(2,5), BTN_SIZE(1,1), F(""), 28, OPT_FLAT);
THEME(transformVal) BTN( BTN_POS(2,6), BTN_SIZE(1,1), F(""), 28, OPT_FLAT); THEME(transformVal) BTN( BTN_POS(2,6), BTN_SIZE(1,1), F(""), 28, OPT_FLAT);
sprintf(b, "0x%08lX", T_Transform_A); BTX( BTN_POS(2,1), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_A); BTX( BTN_POS(2,1), BTN_SIZE(1,1), b, 28);
sprintf(b, "0x%08lX", T_Transform_B); BTX( BTN_POS(2,2), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_B); BTX( BTN_POS(2,2), BTN_SIZE(1,1), b, 28);
sprintf(b, "0x%08lX", T_Transform_C); BTX( BTN_POS(2,3), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_C); BTX( BTN_POS(2,3), BTN_SIZE(1,1), b, 28);
sprintf(b, "0x%08lX", T_Transform_D); BTX( BTN_POS(2,4), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_D); BTX( BTN_POS(2,4), BTN_SIZE(1,1), b, 28);
sprintf(b, "0x%08lX", T_Transform_E); BTX( BTN_POS(2,5), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_E); BTX( BTN_POS(2,5), BTN_SIZE(1,1), b, 28);
sprintf(b, "0x%08lX", T_Transform_F); BTX( BTN_POS(2,6), BTN_SIZE(1,1), b, 28); sprintf_P(b, PSTR("0x%08lX"), T_Transform_F); BTX( BTN_POS(2,6), BTN_SIZE(1,1), b, 28);
#define GRID_COLS 3 #define GRID_COLS 3
@ -1230,6 +1349,8 @@ bool MoveAxisScreen::onTouchHeld(uint8_t tag) {
case 5: axis = Marlin_LCD_API::Y; inc *= 1; break; case 5: axis = Marlin_LCD_API::Y; inc *= 1; break;
case 6: axis = Marlin_LCD_API::Z; inc *= -1; break; case 6: axis = Marlin_LCD_API::Z; inc *= -1; break;
case 7: axis = Marlin_LCD_API::Z; inc *= 1; break; case 7: axis = Marlin_LCD_API::Z; inc *= 1; break;
default:
return false;
} }
Marlin_LCD_API::setAxisPosition_mm(axis, Marlin_LCD_API::getAxisPosition_mm(axis) + inc, feedrate_mm_s); Marlin_LCD_API::setAxisPosition_mm(axis, Marlin_LCD_API::getAxisPosition_mm(axis) + inc, feedrate_mm_s);
onRefresh(); onRefresh();
@ -1303,13 +1424,18 @@ void StepsScreen::onRefresh() {
CLCD::CommandFifo cmd; CLCD::CommandFifo cmd;
cmd.Cmd(CMD_DLSTART); cmd.Cmd(CMD_DLSTART);
/* Tag Label: Units: Color: Precision: */ /* Tag Label: Units: Color: Precision: */
const heading_t h = { PSTR("Steps/mm") }; const heading_t h = { PSTR("Steps/mm") };
const adjuster_t x = {2, PSTR("X:"), PSTR(""), Theme::x_axis, 0 }; const adjuster_t x = {2, PSTR("X:"), PSTR(""), Theme::x_axis, 0 };
const adjuster_t y = {4, PSTR("Y:"), PSTR(""), Theme::y_axis, 0 }; const adjuster_t y = {4, PSTR("Y:"), PSTR(""), Theme::y_axis, 0 };
const adjuster_t z = {6, PSTR("Z:"), PSTR(""), Theme::z_axis, 0 }; const adjuster_t z = {6, PSTR("Z:"), PSTR(""), Theme::z_axis, 0 };
const adjuster_t e = {8, PSTR("E:"), PSTR(""), Theme::e_axis, 0 }; #if EXTRUDERS == 1
const increment_t i = { 0 }; const adjuster_t e0 = {8, PSTR("E:"), PSTR(""), Theme::e_axis, 0 };
#else
const adjuster_t e0 = {8, PSTR("E0:"), PSTR(""), Theme::e_axis, 0 };
const adjuster_t e1 = {10, PSTR("E1:"), PSTR(""), Theme::e_axis, 0 };
#endif
const increment_t i = { 0 };
stacker_t s; stacker_t s;
if(dlcache.hasData()) { if(dlcache.hasData()) {
@ -1320,16 +1446,22 @@ void StepsScreen::onRefresh() {
x.static_parts(s); x.static_parts(s);
y.static_parts(s); y.static_parts(s);
z.static_parts(s); z.static_parts(s);
e.static_parts(s); e0.static_parts(s);
#if EXTRUDERS == 2
e1.static_parts(s);
#endif
i.static_parts(s); i.static_parts(s);
dlcache.store(); dlcache.store();
} }
s.dynamic_parts(); s.dynamic_parts();
h.dynamic_parts(s); h.dynamic_parts(s);
x.dynamic_parts(s,marlin_x_steps ); x.dynamic_parts(s,Marlin_LCD_API::getAxisSteps_per_mm(Marlin_LCD_API::X) );
y.dynamic_parts(s,marlin_y_steps ); y.dynamic_parts(s,Marlin_LCD_API::getAxisSteps_per_mm(Marlin_LCD_API::Y) );
z.dynamic_parts(s,marlin_z_steps ); z.dynamic_parts(s,Marlin_LCD_API::getAxisSteps_per_mm(Marlin_LCD_API::Z) );
e.dynamic_parts(s,marlin_e0_steps); e0.dynamic_parts(s,Marlin_LCD_API::getAxisSteps_per_mm(Marlin_LCD_API::E0));
#if EXTRUDERS == 2
e1.dynamic_parts(s,Marlin_LCD_API::getAxisSteps_per_mm(Marlin_LCD_API::E1));
#endif
i.dynamic_parts(s); i.dynamic_parts(s);
cmd.Cmd(DL_DISPLAY); cmd.Cmd(DL_DISPLAY);
@ -1338,18 +1470,27 @@ void StepsScreen::onRefresh() {
} }
bool StepsScreen::onTouchHeld(uint8_t tag) { bool StepsScreen::onTouchHeld(uint8_t tag) {
float inc = getIncrement();
Marlin_LCD_API::axis_t axis;
switch(tag) { switch(tag) {
case 2: marlin_x_steps -= getIncrement(); break; case 2: axis = Marlin_LCD_API::X; inc *= -1; break;
case 3: marlin_x_steps += getIncrement(); break; case 3: axis = Marlin_LCD_API::X; inc *= 1; break;
case 4: marlin_y_steps -= getIncrement(); break; case 4: axis = Marlin_LCD_API::Y; inc *= -1; break;
case 5: marlin_y_steps += getIncrement(); break; case 5: axis = Marlin_LCD_API::Y; inc *= 1; break;
case 6: marlin_z_steps -= getIncrement(); break; case 6: axis = Marlin_LCD_API::Z; inc *= -1; break;
case 7: marlin_z_steps += getIncrement(); break; case 7: axis = Marlin_LCD_API::Z; inc *= 1; break;
case 8: marlin_e0_steps -= getIncrement(); break; case 8: axis = Marlin_LCD_API::E0; inc *= -1; break;
case 9: marlin_e0_steps += getIncrement(); break; case 9: axis = Marlin_LCD_API::E0; inc *= 1; break;
#if EXTRUDERS == 2
case 10: axis = Marlin_LCD_API::E1; inc *= -1; break;
case 11: axis = Marlin_LCD_API::E1; inc *= 1; break;
#endif
default: default:
return false; return false;
} }
Marlin_LCD_API::setAxisSteps_per_mm(axis, Marlin_LCD_API::getAxisSteps_per_mm(axis) + inc);
onRefresh(); onRefresh();
return true; return true;
} }
@ -1378,7 +1519,7 @@ void ZOffsetScreen::onRefresh() {
} }
s.dynamic_parts(); s.dynamic_parts();
h.dynamic_parts(s); h.dynamic_parts(s);
z.dynamic_parts(s,marlin_z_offset); z.dynamic_parts(s,Marlin_LCD_API::getZOffset_mm());
i.dynamic_parts(s); i.dynamic_parts(s);
cmd.Cmd(DL_DISPLAY); cmd.Cmd(DL_DISPLAY);
@ -1388,8 +1529,8 @@ void ZOffsetScreen::onRefresh() {
bool ZOffsetScreen::onTouchHeld(uint8_t tag) { bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
switch(tag) { switch(tag) {
case 4: marlin_z_offset -= getIncrement(); break; case 4: Marlin_LCD_API::incrementZOffset_mm(-getIncrement()); break;
case 5: marlin_z_offset += getIncrement(); break; case 5: Marlin_LCD_API::incrementZOffset_mm( getIncrement()); break;
default: default:
return false; return false;
} }
@ -1432,17 +1573,19 @@ void lcd_init() {
} }
void lcd_update() { void lcd_update() {
const uint8_t NONE = 0xFF; const uint8_t NONE = 0xFF;
const uint8_t IGNORE = 0xFE; const uint8_t IGNORE = 0xFE;
static uint8_t pressed = NONE; static uint8_t pressed = NONE;
static uint32_t last_repeat = 0; static uint8_t last_repeat = 0;
static uint32_t last_update = 0; static uint8_t last_update = 0;
const uint8_t tiny_millis = tiny_interval(millis());
sound.onIdle(); sound.onIdle();
if(millis() - last_update > DISPLAY_UPDATE_INTERVAL) { if(tiny_millis - last_update > tiny_interval(DISPLAY_UPDATE_INTERVAL)) {
current_screen.onIdle(); current_screen.onIdle();
last_update = millis(); last_update = tiny_millis;
} }
// If the LCD is processing commands, don't check // If the LCD is processing commands, don't check
@ -1472,7 +1615,7 @@ void lcd_update() {
#if defined (SERIAL_PROTOCOLLNPAIR) #if defined (SERIAL_PROTOCOLLNPAIR)
SERIAL_PROTOCOLLNPAIR("Touch end: ", tag); SERIAL_PROTOCOLLNPAIR("Touch end: ", tag);
#else #else
Serial.print("Touch end: "); Serial.print(F("Touch end: "));
Serial.println(tag); Serial.println(tag);
#endif #endif
#endif #endif
@ -1483,14 +1626,14 @@ void lcd_update() {
const uint8_t lastScreen = current_screen.getScreen(); const uint8_t lastScreen = current_screen.getScreen();
if(current_screen.onTouchStart(tag)) { if(current_screen.onTouchStart(tag)) {
last_repeat = millis(); last_repeat = tiny_millis;
sound.play(Theme::press_sound); sound.play(Theme::press_sound);
#if defined(UI_FRAMEWORK_DEBUG) #if defined(UI_FRAMEWORK_DEBUG)
#if defined (SERIAL_PROTOCOLLNPAIR) #if defined (SERIAL_PROTOCOLLNPAIR)
SERIAL_PROTOCOLLNPAIR("Touch start: ", tag); SERIAL_PROTOCOLLNPAIR("Touch start: ", tag);
#else #else
Serial.print("Touch start: "); Serial.print(F("Touch start: "));
Serial.println(tag); Serial.println(tag);
#endif #endif
#endif #endif
@ -1506,10 +1649,10 @@ void lcd_update() {
} }
} else if(tag == pressed) { } else if(tag == pressed) {
// The user is holding down a button. // The user is holding down a button.
if((millis() - last_repeat) > (1000 / TOUCH_REPEATS_PER_SECOND)) { if((tiny_millis - last_repeat) > tiny_interval(1000 / TOUCH_REPEATS_PER_SECOND)) {
if(current_screen.onTouchHeld(tag)) { if(current_screen.onTouchHeld(tag)) {
sound.play(Theme::repeat_sound); sound.play(Theme::repeat_sound);
last_repeat = millis(); last_repeat = tiny_millis;
} }
} }
} }

@ -52,6 +52,13 @@ const PROGMEM CLCD::SoundPlayer::sound_t sad_trombone[] = {
{SILENCE, END_SONG, 0} {SILENCE, END_SONG, 0}
}; };
const PROGMEM CLCD::SoundPlayer::sound_t c_maj_arpeggio[] = {
{GLOCKENSPIEL, NOTE_C4, 1},
{GLOCKENSPIEL, NOTE_E4, 1},
{GLOCKENSPIEL, NOTE_G4, 16},
{SILENCE, END_SONG, 0}
};
const PROGMEM CLCD::SoundPlayer::sound_t js_bach_joy[] = { const PROGMEM CLCD::SoundPlayer::sound_t js_bach_joy[] = {
{PIANO, NOTE_G3, 10}, {PIANO, NOTE_G3, 10},
{PIANO, NOTE_A3, 10}, {PIANO, NOTE_A3, 10},

@ -47,7 +47,9 @@ class Marlin_LCD_API {
static const void setTargetTemp_celsius(const uint8_t extruder, float temp); static const void setTargetTemp_celsius(const uint8_t extruder, float temp);
static const void setFan_percent(const uint8_t fan, float percent); static const void setFan_percent(const uint8_t fan, float percent);
static const void setAxisPosition_mm(const Marlin_LCD_API::axis_t axis, float position, float _feedrate_mm_s); static const void setAxisPosition_mm(const axis_t axis, float position, float _feedrate_mm_s);
static const void setAxisSteps_per_mm(const axis_t axis, float steps_per_mm);
static const void incrementZOffset_mm(const float z_offset);
static const void runGCode(progmem_str gcode); static const void runGCode(progmem_str gcode);
@ -111,7 +113,36 @@ const bool Marlin_LCD_API::isMoving() {
} }
const float Marlin_LCD_API::getAxisSteps_per_mm(const Marlin_LCD_API::axis_t axis) { const float Marlin_LCD_API::getAxisSteps_per_mm(const Marlin_LCD_API::axis_t axis) {
return 0; switch(axis) {
case X: return planner.axis_steps_per_mm[X_AXIS];
case Y: return planner.axis_steps_per_mm[Y_AXIS];
case Z: return planner.axis_steps_per_mm[Z_AXIS];
case E0: return planner.axis_steps_per_mm[E_AXIS];
case E1: return planner.axis_steps_per_mm[E_AXIS+1];
}
}
const void Marlin_LCD_API::setAxisSteps_per_mm(const Marlin_LCD_API::axis_t axis, float steps_per_mm) {
switch(axis) {
case X: planner.axis_steps_per_mm[X_AXIS] = steps_per_mm; break;
case Y: planner.axis_steps_per_mm[Y_AXIS] = steps_per_mm; break;
case Z: planner.axis_steps_per_mm[Z_AXIS] = steps_per_mm; break;
case E0: planner.axis_steps_per_mm[E_AXIS] = steps_per_mm; break;
case E1: planner.axis_steps_per_mm[E_AXIS+1] = steps_per_mm; break;
}
}
const void Marlin_LCD_API::incrementZOffset_mm(float babystep_increment) {
const float new_zoffset = zprobe_zoffset + babystep_increment;
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
if (planner.leveling_active) {
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
}
#endif
zprobe_zoffset = new_zoffset;
}
} }
const uint8_t Marlin_LCD_API::getProgress_percent() { const uint8_t Marlin_LCD_API::getProgress_percent() {
@ -129,6 +160,10 @@ const uint8_t Marlin_LCD_API::getFeedRate_percent() {
return feedrate_percentage; return feedrate_percentage;
} }
const float Marlin_LCD_API::getZOffset_mm() {
return zprobe_zoffset;
}
const void Marlin_LCD_API::runGCode(progmem_str gcode) { const void Marlin_LCD_API::runGCode(progmem_str gcode) {
enqueue_and_echo_commands_P((const char*)gcode); enqueue_and_echo_commands_P((const char*)gcode);
} }

@ -13,7 +13,7 @@
* got disabled. * got disabled.
*/ */
#define LULZBOT_FW_VERSION ".9" // Change this with each update #define LULZBOT_FW_VERSION ".10" // Change this with each update
#if ( \ #if ( \
!defined(LULZBOT_Gladiola_Mini) && \ !defined(LULZBOT_Gladiola_Mini) && \

@ -268,9 +268,11 @@ void ST7920_Lite_Status_Screen::draw_static_elements() {
draw_gdram_icon(1,1,nozzle_icon); draw_gdram_icon(1,1,nozzle_icon);
#if EXTRUDERS == 2 #if EXTRUDERS == 2
draw_gdram_icon(1,2,nozzle_icon); draw_gdram_icon(1,2,nozzle_icon);
draw_gdram_icon(1,3,bed_icon);
#else
draw_gdram_icon(1,2,bed_icon);
#endif #endif
draw_gdram_icon(6,2,feedrate_icon); draw_gdram_icon(6,2,feedrate_icon);
draw_gdram_icon(1,2,bed_icon);
// Draw the initial fan icon // Draw the initial fan icon
draw_fan_icon(false); draw_fan_icon(false);

Loading…
Cancel
Save