Skip to content

Commit

Permalink
fix: self check wait after error, heater test for CW1S (need to be fi…
Browse files Browse the repository at this point in the history
…xed)
  • Loading branch information
tritol committed Jun 30, 2021
1 parent 1a8211b commit 41a40ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace States {

/*** states definitions ***/
Base menu;
Confirm confirm;
Confirm error;
Confirm confirm(false);
Confirm error(true);
Base washing(
pgmstr_washing,
STATE_OPTION_CONTROLS | STATE_OPTION_WASHING,
Expand Down
18 changes: 15 additions & 3 deletions src/states_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,20 @@ namespace States {


// States::Confirm
Confirm::Confirm() :
Base(pgmstr_emptystr, STATE_OPTION_SHORT_CANCEL), quit(false)
Confirm::Confirm(bool force_wait) :
Base(pgmstr_emptystr, STATE_OPTION_SHORT_CANCEL), force_wait(force_wait), quit(false)
{}

void Confirm::start() {
canceled = false;
quit = true;
us_last = 1; // beep
const char* text2 = pgmstr_emptystr;
switch(config.finish_beep_mode) {
uint8_t mode = config.finish_beep_mode;
if (force_wait) {
mode = 2;
}
switch(mode) {
case 2:
quit = false;
text2 = pgmstr_press2continue;
Expand Down Expand Up @@ -532,10 +536,13 @@ namespace States {
return &error;
}
uint16_t seconds = timer.getCurrentTimeInSeconds() - 1;
#ifdef CW1S
// TODO this is not working on CW1S
if (!seconds && old_chamb_temp + HEATER_TEST_GAIN > hw.chamber_temp_celsius) {
error.new_text(pgmstr_heater_failure, pgmstr_nopower_error);
return &error;
}
#endif
if (seconds != old_seconds) {
old_seconds = seconds;
draw = true;
Expand All @@ -546,8 +553,13 @@ namespace States {
bool Test_heater::get_info2(char* buffer, uint8_t size) {
if (draw) {
buffer_init(buffer, size);
#ifdef CW1S
print_P(pgmstr_fan1);
print(hw.fan_rpm[0]);
#else
print_P(pgmstr_fan3);
print(hw.fan_rpm[2]);
#endif
get_position()[0] = char(0);
draw = false;
return true;
Expand Down
3 changes: 2 additions & 1 deletion src/states_items.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ namespace States {
// States::Confirm
class Confirm : public Base {
public:
Confirm();
Confirm(bool force_wait);
void start();
Base* loop();
private:
bool force_wait;
bool quit;
};

Expand Down

0 comments on commit 41a40ca

Please sign in to comment.