Use uint8_t for all fan speeds (#12032)

This commit is contained in:
Scott Lahteine
2018-10-07 15:34:41 -05:00
committed by GitHub
parent cb7844c8d4
commit d6b0fbd771
25 changed files with 88 additions and 91 deletions

View File

@ -207,7 +207,7 @@ static void lcd_implementation_status_screen() {
static uint8_t fan_frame;
if (old_blink != blink) {
old_blink = blink;
if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0;
if (!fan_speed[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0;
}
#endif
@ -245,7 +245,7 @@ static void lcd_implementation_status_screen() {
fan_frame == 3 ? status_screen3_bmp :
#endif
#else
blink && fanSpeeds[0] ? status_screen1_bmp :
blink && fan_speed[0] ? status_screen1_bmp :
#endif
#endif
status_screen0_bmp
@ -269,7 +269,7 @@ static void lcd_implementation_status_screen() {
#if HAS_FAN0
if (PAGE_CONTAINS(STATUS_SCREEN_FAN_TEXT_Y - 7, STATUS_SCREEN_FAN_TEXT_Y)) {
// Fan
const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256;
const uint16_t per = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
if (per) {
lcd_moveto(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y);
lcd_put_u8str(itostr3(per));

View File

@ -710,7 +710,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
// them only during blinks we gain a bit of stability.
const bool blink = lcd_blink();
const uint16_t feedrate_perc = feedrate_percentage;
const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256;
const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
@ -719,7 +719,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
const int16_t bed_target = thermalManager.degTargetBed();
#endif
static uint16_t last_checksum = 0;
const uint16_t checksum = blink ^ feedrate_perc ^ fan_speed ^ extruder_1_target
const uint16_t checksum = blink ^ feedrate_perc ^ fs ^ extruder_1_target
#if HOTENDS > 1
^ extruder_2_target
#endif
@ -737,7 +737,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
const bool blink = lcd_blink();
const duration_t elapsed = print_job_timer.duration();
const uint16_t feedrate_perc = feedrate_percentage;
const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256;
const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
@ -756,12 +756,12 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#if HAS_HEATED_BED
draw_bed_temp(bed_temp, bed_target, forceUpdate);
#endif
draw_fan_speed(fan_speed);
draw_fan_speed(fs);
draw_print_time(elapsed);
draw_feedrate_percentage(feedrate_perc);
// Update the fan and bed animations
if (fan_speed > 0) draw_fan_icon(blink);
if (fs) draw_fan_icon(blink);
#if HAS_HEATED_BED
if (bed_target > 0)
draw_heat_icon(blink, true);

View File

@ -85,7 +85,7 @@ static const uint8_t u8g_dev_st7920_128x64_HAL_init_seq[] PROGMEM = {
U8G_ESC_END // end of sequence
};
void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev){
void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) {
u8g_SetChipSelect(u8g, dev, 1);
u8g_Delay(1);
u8g_SetAddress(u8g, dev, 0); // cmd mode