Apply TERN to compact code (#17619)
This commit is contained in:
@@ -97,9 +97,7 @@ void HAL_init_board() {
|
||||
esp3dlib.init();
|
||||
#elif ENABLED(WIFISUPPORT)
|
||||
wifi_init();
|
||||
#if ENABLED(OTASUPPORT)
|
||||
OTA_init();
|
||||
#endif
|
||||
TERN_(OTASUPPORT, OTA_init());
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
spiffs_init();
|
||||
web_init();
|
||||
@@ -133,9 +131,7 @@ void HAL_idletask() {
|
||||
#if BOTH(WIFISUPPORT, OTASUPPORT)
|
||||
OTA_handle();
|
||||
#endif
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
esp3dlib.idletask();
|
||||
#endif
|
||||
TERN_(ESP3D_WIFISUPPORT, esp3dlib.idletask());
|
||||
}
|
||||
|
||||
void HAL_clear_reset_source() { }
|
||||
@@ -176,39 +172,17 @@ void HAL_adc_init() {
|
||||
adc1_config_width(ADC_WIDTH_12Bit);
|
||||
|
||||
// Configure channels only if used as (re-)configuring a pin for ADC that is used elsewhere might have adverse effects
|
||||
#if HAS_TEMP_ADC_0
|
||||
adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_1
|
||||
adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_2
|
||||
adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_3
|
||||
adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_4
|
||||
adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_5
|
||||
adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_6
|
||||
adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_ADC_7
|
||||
adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if HAS_TEMP_CHAMBER
|
||||
adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||
adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db);
|
||||
#endif
|
||||
TERN_(HAS_TEMP_ADC_0, adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_1, adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_2, adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_3, adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_4, adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_5, adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_6, adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
|
||||
TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
|
||||
TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
|
||||
|
||||
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
|
||||
// That's why we're not setting it up here.
|
||||
|
||||
Reference in New Issue
Block a user