Skip to content

Commit

Permalink
misc. adjustments, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 8, 2023
1 parent 4bfe64b commit e18d8d2
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ enum ADCIndex : uint8_t {
OPTITEM(HAS_TEMP_ADC_PROBE, TEMP_PROBE)
OPTITEM(HAS_TEMP_COOLER, TEMP_COOLER)
OPTITEM(HAS_TEMP_BOARD, TEMP_BOARD)
OPTITEM(HAS_TEMP_SOC, TEMP_SOC_PIN)
OPTITEM(HAS_TEMP_SOC, TEMP_SOC)
OPTITEM(FILAMENT_WIDTH_SENSOR, FILWIDTH)
OPTITEM(HAS_ADC_BUTTONS, ADC_KEY)
OPTITEM(HAS_JOY_ADC_X, JOY_X)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
#define STR_HEATER_CHAMBER "chamber"
#define STR_COOLER "cooler"
#define STR_MOTHERBOARD "motherboard"
#define STR_SOC "SoC"
#define STR_SOC "soc"
#define STR_PROBE "probe"
#define STR_REDUNDANT "redundant "
#define STR_LASER_TEMP "laser temperature"
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/feature/controllerfan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ void ControllerFan::update() {
const ena_mask_t axis_mask = TERN(CONTROLLER_FAN_USE_Z_ONLY, _BV(Z_AXIS), (ena_mask_t)~TERN0(CONTROLLER_FAN_IGNORE_Z, _BV(Z_AXIS)));
if ( (stepper.axis_enabled.bits & axis_mask)
|| TERN0(HAS_HEATED_BED, thermalManager.temp_bed.soft_pwm_amount > 0)
|| TERN0(HAS_CONTROLLER_FAN_MIN_BOARD_TEMP, thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP)
|| TERN0(HAS_CONTROLLER_FAN_MIN_SOC_TEMP, thermalManager.wholeDegSoc() >= CONTROLLER_FAN_MIN_SOC_TEMP)
#ifdef CONTROLLER_FAN_MIN_BOARD_TEMP
|| thermalManager.wholeDegBoard() >= CONTROLLER_FAN_MIN_BOARD_TEMP
#endif
#ifdef CONTROLLER_FAN_MIN_SOC_TEMP
|| thermalManager.wholeDegSoc() >= CONTROLLER_FAN_MIN_SOC_TEMP
#endif
) lastMotorOn = ms; //... set time to NOW so the fan will turn on

// Fan Settings. Set fan > 0:
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2718,9 +2718,6 @@
*/
#if PIN_EXISTS(CONTROLLER_FAN)
#define HAS_CONTROLLER_FAN 1
#if CONTROLLER_FAN_MIN_BOARD_TEMP
#define HAS_CONTROLLER_FAN_MIN_BOARD_TEMP 1
#endif
#endif

#if HAS_CONTROLLER_FAN
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2739,8 +2739,6 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
#if TEMP_SENSOR_SOC
#if !PIN_EXISTS(TEMP_SOC)
#error "TEMP_SENSOR_SOC requires TEMP_SOC_PIN."
#elif !defined(TEMP_SOC_SENSOR)
#error "TEMP_SENSOR_SOC requires TEMP_SOC_SENSOR(RAW) to be defined. It may not be implemented for your specific board."
#endif
#elif CONTROLLER_FAN_MIN_SOC_TEMP
#error "CONTROLLER_FAN_MIN_SOC_TEMP requires TEMP_SENSOR_SOC."
Expand Down
30 changes: 18 additions & 12 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2376,9 +2376,16 @@ void Temperature::task() {
#if HAS_TEMP_SOC
// For SoC temperature measurement.
celsius_float_t Temperature::analog_to_celsius_soc(const raw_adc_t raw) {
return TEMP_SOC_SENSOR(raw);
return (
#ifdef TEMP_SOC_SENSOR
TEMP_SOC_SENSOR(raw)
#else
0
#error "TEMP_SENSOR_SOC requires the TEMP_SOC_SENSOR(RAW) macro to be defined for your board."
#endif
);
}
#endif // HAS_TEMP_SOC
#endif

#if HAS_TEMP_REDUNDANT
// For redundant temperature measurement.
Expand Down Expand Up @@ -3996,10 +4003,10 @@ void Temperature::isr() {
* Print a single heater state in the form:
* Bed: " B:nnn.nn /nnn.nn"
* Chamber: " C:nnn.nn /nnn.nn"
* Probe: " P:nnn.nn /nnn.nn"
* Probe: " P:nnn.nn"
* Cooler: " L:nnn.nn /nnn.nn"
* Board: " M:nnn.nn /nnn.nn"
* SoC: " S:nnn.nn /nnn.nn"
* Board: " M:nnn.nn"
* SoC: " S:nnn.nn"
* Redundant: " R:nnn.nn /nnn.nn"
* Extruder: " T0:nnn.nn /nnn.nn"
* With ADC: " T0:nnn.nn /nnn.nn (nnn.nn)"
Expand All @@ -4008,6 +4015,7 @@ void Temperature::isr() {
OPTARG(SHOW_TEMP_ADC_VALUES, const float r)
) {
char k;
bool show_t = true;
switch (e) {
default:
#if HAS_TEMP_HOTEND
Expand All @@ -4020,16 +4028,16 @@ void Temperature::isr() {
case H_CHAMBER: k = 'C'; break;
#endif
#if HAS_TEMP_PROBE
case H_PROBE: k = 'P'; break;
case H_PROBE: k = 'P'; show_t = false; break;
#endif
#if HAS_TEMP_COOLER
case H_COOLER: k = 'L'; break;
#endif
#if HAS_TEMP_BOARD
case H_BOARD: k = 'M'; break;
case H_BOARD: k = 'M'; show_t = false; break;
#endif
#if HAS_TEMP_SOC
case H_SOC: k = 'S'; break;
case H_SOC: k = 'S'; show_t = false; break;
#endif
#if HAS_TEMP_REDUNDANT
case H_REDUNDANT: k = 'R'; break;
Expand All @@ -4044,10 +4052,8 @@ void Temperature::isr() {
#else
#define SFP 2
#endif
SERIAL_CHAR(':');
SERIAL_PRINT(c, SFP);
SERIAL_ECHOPGM(" /");
SERIAL_PRINT(t, SFP);
SERIAL_CHAR(':'); SERIAL_PRINT(c, SFP);
if (show_t) { SERIAL_ECHOPGM(" /"); SERIAL_PRINT(t, SFP); }
#if ENABLED(SHOW_TEMP_ADC_VALUES)
// Temperature MAX SPI boards do not have an OVERSAMPLENR defined
SERIAL_ECHOPGM(" (", TERN(HAS_MAXTC_LIBRARIES, k == 'T', false) ? r : r * RECIPROCAL(OVERSAMPLENR));
Expand Down
4 changes: 2 additions & 2 deletions buildroot/tests/STM32F103RC_btt_USB
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ set -e
# Build with the default configurations
#
restore_configs
opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_V1_1 SERIAL_PORT 1 SERIAL_PORT_2 -1
exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - Basic Configuration" "$3"
opt_set MOTHERBOARD BOARD_BTT_SKR_MINI_V1_1 SERIAL_PORT 1 SERIAL_PORT_2 -1 TEMP_SENSOR_SOC 1
exec_test $1 $2 "BigTreeTech SKR Mini v1.1 - SOC Temperature" "$3"

# clean up
restore_configs

0 comments on commit e18d8d2

Please sign in to comment.