Skip to content

Commit

Permalink
Merge pull request #9 from mkbel/dots_fix
Browse files Browse the repository at this point in the history
Fix compiler warning int first_position may be used uninitialized in …
  • Loading branch information
jarodan authored May 24, 2019
2 parents 5822c8b + 9eff52d commit 8ad065b
Showing 1 changed file with 23 additions and 39 deletions.
62 changes: 23 additions & 39 deletions Prusa-CW-Firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static void fan_pwm_control();
static void fan_heater_rpm();
static void fan_rpm();
static void preheat();
static void lcd_time_print();
static void lcd_time_print(uint8_t dots_column);
static void therm1_read();
static void get_serial_num(Serial_num_t &sn);

Expand Down Expand Up @@ -1965,7 +1965,8 @@ void start_drying() {
gastro_pan = false;
}
}
lcd_time_print();
if (!preheat_complete) lcd_time_print(8);
else lcd_time_print(7);
}

void start_curing() {
Expand Down Expand Up @@ -2025,7 +2026,7 @@ void start_curing() {
gastro_pan = false;
}
}
lcd_time_print();
lcd_time_print(7);
}

void start_washing() {
Expand Down Expand Up @@ -2071,7 +2072,7 @@ void start_washing() {
tDown.start();
}

lcd_time_print();
lcd_time_print(8);
}
} else {
menu_position = 0;
Expand Down Expand Up @@ -2139,7 +2140,7 @@ void start_washing() {
tDown.pause();
}

lcd_time_print();
lcd_time_print(8);
}
} else {
menu_position = 0;
Expand Down Expand Up @@ -2200,7 +2201,11 @@ void stop_curing_drying() {
menu_move(true);
}

void lcd_time_print() {
//! @brief Display remaining time
//!
//! @param dots_column Zero indexed column of first line
//! where to to start printing progress dots.
void lcd_time_print(uint8_t dots_column) {
byte mins;
byte secs;
if (heat_to_target_temp) {
Expand Down Expand Up @@ -2246,25 +2251,8 @@ void lcd_time_print() {
if (!paused && !paused_time) {
lcd.setCursor(19, 1);
lcd.print(" ");
int first_position;

if (curing_mode) {
if (!drying_mode) {
first_position = 7;
}
if (drying_mode) {
if (heat_to_target_temp) {
if (!preheat_complete) {
first_position = 8;
}
else {
first_position = 7;
}
}
else {
first_position = 7;
}
}
if (outputchip.digitalRead(COVER_OPEN_PIN) == LOW) {
if (SI_unit_system) {
lcd.setCursor(13, 0);
Expand All @@ -2285,44 +2273,40 @@ void lcd_time_print() {
}
}

if (!curing_mode) {
first_position = 8;
}

if (running_count == 0) {
lcd.setCursor(first_position, 0);
lcd.setCursor(dots_column, 0);
lcd.print(" ");
lcd.setCursor(first_position + 1, 0);
lcd.setCursor(dots_column + 1, 0);
lcd.print(" ");
lcd.setCursor(first_position + 2, 0);
lcd.setCursor(dots_column + 2, 0);
lcd.print(" ");
}
if (running_count == 1) {
lcd.setCursor(first_position, 0);
lcd.setCursor(dots_column, 0);
lcd.print(".");
lcd.setCursor(first_position + 1, 0);
lcd.setCursor(dots_column + 1, 0);
lcd.print(" ");
lcd.setCursor(first_position + 2, 0);
lcd.setCursor(dots_column + 2, 0);
lcd.print(" ");
}
if (running_count == 2) {
lcd.setCursor(first_position, 0);
lcd.setCursor(dots_column, 0);
lcd.print(".");
lcd.setCursor(first_position + 1, 0);
lcd.setCursor(dots_column + 1, 0);
lcd.print(".");
lcd.setCursor(first_position + 2, 0);
lcd.setCursor(dots_column + 2, 0);
lcd.print(" ");
lcd.setCursor(14, 2);
lcd.print(" ");
lcd.setCursor(5, 2);
lcd.print(" ");
}
if (running_count == 3) {
lcd.setCursor(first_position, 0);
lcd.setCursor(dots_column, 0);
lcd.print(".");
lcd.setCursor(first_position + 1, 0);
lcd.setCursor(dots_column + 1, 0);
lcd.print(".");
lcd.setCursor(first_position + 2, 0);
lcd.setCursor(dots_column + 2, 0);
lcd.print(".");
}

Expand Down

0 comments on commit 8ad065b

Please sign in to comment.