Convert fanSpeed and saved_fan_speed to uint8_t

These variables only range from 0 to 255

For the menus we currently need to convert fanSpeed to int16_t.

Change in memory:
Flash: -160 bytes
SRAM: -2 bytes
This commit is contained in:
Guðni Már Gilbert 2023-01-27 21:12:58 +00:00 committed by DRracer
parent 76a8c80ef0
commit 2ced00f21c
4 changed files with 15 additions and 15 deletions

View File

@ -278,7 +278,7 @@ extern float destination[NUM_AXIS] ;
extern float min_pos[3];
extern float max_pos[3];
extern bool axis_known_position[3];
extern int fanSpeed;
extern uint8_t fanSpeed; //!< Print fan speed, ranges from 0 to 255
extern uint8_t newFanSpeed;
extern float default_retraction;
@ -340,7 +340,7 @@ extern uint8_t saved_printing_type;
extern float saved_extruder_temperature; //!< Active extruder temperature
extern float saved_bed_temperature; //!< Bed temperature
extern int saved_fan_speed; //!< Print fan speed
extern uint8_t saved_fan_speed; //!< Print fan speed, ranges from 0 to 255
//estimated time to end of the print
extern uint8_t print_percent_done_normal;

View File

@ -214,7 +214,7 @@ float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
bool axis_known_position[3] = {false, false, false};
int fanSpeed=0;
uint8_t fanSpeed = 0;
uint8_t newFanSpeed = 0;
#ifdef FWRETRACT
@ -335,7 +335,7 @@ static int saved_feedmultiply2 = 0;
float saved_extruder_temperature = 0.0; //!< Active extruder temperature
float saved_bed_temperature = 0.0;
static bool saved_extruder_relative_mode = false;
int saved_fan_speed = 0; //!< Print fan speed
uint8_t saved_fan_speed = 0; //!< Print fan speed
//! @}
static int saved_feedmultiply_mm = 100;
@ -3410,7 +3410,7 @@ void gcode_M114()
#if (defined(FANCHECK) && (((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1)))))
void gcode_M123()
{
printf_P(_N("E0:%d RPM PRN1:%d RPM E0@:%u PRN1@:%d\n"), 60*fan_speed[active_extruder], 60*fan_speed[1], newFanSpeed, fanSpeed);
printf_P(_N("E0:%d RPM PRN1:%d RPM E0@:%u PRN1@:%u\n"), 60*fan_speed[active_extruder], 60*fan_speed[1], newFanSpeed, fanSpeed);
}
#endif //FANCHECK and TACH_0 or TACH_1
@ -3476,7 +3476,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
//First backup current position and settings
int feedmultiplyBckp = feedmultiply;
float HotendTempBckp = degTargetHotend(active_extruder);
int fanSpeedBckp = fanSpeed;
uint8_t fanSpeedBckp = fanSpeed;
memcpy(lastpos, current_position, sizeof(lastpos));
@ -9563,7 +9563,7 @@ void ThermalStop(bool allow_recovery)
// original values after the pause handler is called.
float bed_temp = saved_bed_temperature;
float ext_temp = saved_extruder_temperature;
int fan_speed = saved_fan_speed;
uint8_t fan_speed = saved_fan_speed;
lcd_pause_print();
saved_bed_temperature = bed_temp;
saved_extruder_temperature = ext_temp;

View File

@ -530,11 +530,11 @@ bool e_active()
void check_axes_activity()
{
unsigned char x_active = 0;
unsigned char y_active = 0;
unsigned char z_active = 0;
unsigned char e_active = 0;
unsigned char tail_fan_speed = fanSpeed;
uint8_t x_active = 0;
uint8_t y_active = 0;
uint8_t z_active = 0;
uint8_t e_active = 0;
uint8_t tail_fan_speed = fanSpeed;
block_t *block;
if(block_buffer_tail != block_buffer_head)

View File

@ -2776,7 +2776,7 @@ void lcd_wait_for_heater() {
void lcd_wait_for_cool_down() {
setTargetHotend(0);
setTargetBed(0);
int fanSpeedBckp = fanSpeed;
uint8_t fanSpeedBckp = fanSpeed;
fanSpeed = 255;
while ((degHotend(0)>MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) {
lcd_display_message_fullscreen_P(_i("Waiting for nozzle and bed cooling"));////MSG_WAITING_TEMP c=20 r=4
@ -5508,7 +5508,7 @@ static void lcd_tune_menu()
MENU_ITEM_EDIT_int3_P(_T(MSG_NOZZLE), &target_temperature[0], 0, HEATER_0_MAXTEMP - 10);//3
MENU_ITEM_EDIT_int3_P(_T(MSG_BED), &target_temperature_bed, 0, BED_MAXTEMP - 10);
MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), &fanSpeed, 0, 255);//5
MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), (int16_t*)&fanSpeed, 0, 255);//5
MENU_ITEM_EDIT_int3_P(_i("Flow"), &extrudemultiply, 10, 999);//6////MSG_FLOW c=15
#ifdef LA_LIVE_K
MENU_ITEM_EDIT_advance_K();//7
@ -5633,7 +5633,7 @@ static void lcd_control_temperature_menu()
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT_int3_P(_T(MSG_BED), &target_temperature_bed, 0, BED_MAXTEMP - 3);
#endif
MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), &fanSpeed, 0, 255);
MENU_ITEM_EDIT_int3_P(_T(MSG_FAN_SPEED), (int16_t*)&fanSpeed, 0, 255);
#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0)
//MENU_ITEM_EDIT removed, following code must be redesigned if AUTOTEMP enabled
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);