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

@ -27,7 +27,7 @@
#include "../module/stepper_indirection.h"
#include "../module/temperature.h"
uint8_t controllerFanSpeed;
uint8_t controllerfan_speed;
void controllerfan_update() {
static millis_t lastMotorOn = 0, // Last time a motor was turned on
@ -75,7 +75,7 @@ void controllerfan_update() {
// Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
controllerFanSpeed = speed;
controllerfan_speed = speed;
// allows digital or PWM fan output to be used (see M42 handling)
WRITE(CONTROLLER_FAN_PIN, speed);

View File

@ -39,15 +39,15 @@ millis_t Power::lastPowerOn;
bool Power::is_power_needed() {
#if ENABLED(AUTO_POWER_FANS)
for (uint8_t i = 0; i < FAN_COUNT; i++) if (fanSpeeds[i] > 0) return true;
for (uint8_t i = 0; i < FAN_COUNT; i++) if (fan_speed[i]) return true;
#endif
#if ENABLED(AUTO_POWER_E_FANS)
HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true;
#endif
#if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN)
if (controllerFanSpeed > 0) return true;
if (controllerfan_speed) return true;
#endif
// If any of the drivers or the bed are enabled...

View File

@ -82,9 +82,9 @@ extern uint8_t commands_in_queue, cmd_queue_index_r;
#endif
#if FAN_COUNT
SERIAL_PROTOCOLPGM("fanSpeeds: ");
SERIAL_PROTOCOLPGM("fan_speed: ");
for (int8_t i = 0; i < FAN_COUNT; i++) {
SERIAL_PROTOCOL(job_recovery_info.fanSpeeds[i]);
SERIAL_PROTOCOL(job_recovery_info.fan_speed[i]);
if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
}
SERIAL_EOL();
@ -264,7 +264,7 @@ void save_job_recovery_info() {
#endif
#if FAN_COUNT
COPY(job_recovery_info.fanSpeeds, fanSpeeds);
COPY(job_recovery_info.fan_speed, fan_speed);
#endif
#if HAS_LEVELING

View File

@ -52,7 +52,7 @@ typedef struct {
#endif
#if FAN_COUNT
int16_t fanSpeeds[FAN_COUNT];
uint8_t fan_speed[FAN_COUNT];
#endif
#if HAS_LEVELING