@@ -12,10 +12,10 @@ APB::History::History() {
1212}
1313
1414
15- #if APB_HEATERS_SIZE > 0
16- void APB::History::Entry::PWMOutput::set (const APB::PWMOutput &heater ) {
17- temperatureHundredth = static_cast <int16_t >(heater .temperature ().value_or (-100.0 ) * 100.0 );
18- duty = heater .active () ? heater .duty () : 0 ;
15+ #if APB_PWM_OUTPUTS_SIZE > 0
16+ void APB::History::Entry::PWMOutput::set (const APB::PWMOutput &pwmOutput ) {
17+ temperatureHundredth = static_cast <int16_t >(pwmOutput .temperature ().value_or (-100.0 ) * 100.0 );
18+ duty = pwmOutput .active () ? pwmOutput .duty () : 0 ;
1919}
2020#endif
2121
@@ -45,14 +45,14 @@ void APB::History::Entry::populate(JsonObject object) {
4545 object[" ambientDewpoint" ] = static_cast <char *>(0 );
4646#endif
4747
48- #if APB_HEATERS_SIZE > 0
49- for (uint8_t i=0 ; i<heaters .size (); i++) {
50- JsonObject heaterObject = object[" heaters " ][i].to <JsonObject>();;
51- heaterObject [" duty" ] = heaters [i].getDuty ();
52- setNullableFloat (heaterObject , " temperature" , heaters [i].getTemperature ());
48+ #if APB_PWM_OUTPUTS_SIZE > 0
49+ for (uint8_t i=0 ; i<pwmOutputs .size (); i++) {
50+ JsonObject pwmOutput = object[" pwmOutputs " ][i].to <JsonObject>();;
51+ pwmOutput [" duty" ] = pwmOutputs [i].getDuty ();
52+ setNullableFloat (pwmOutput , " temperature" , pwmOutputs [i].getTemperature ());
5353 }
5454#else
55- object[" heaters " ].to <JsonArray>();
55+ object[" pwmOutputs " ].to <JsonArray>();
5656#endif
5757 object[" busVoltage" ] = getBusVoltage ();
5858 object[" power" ] = getPower ();
@@ -75,16 +75,16 @@ void APB::History::add() {
7575 }
7676
7777 APB::History::Entry entry {
78- esp_timer_get_time () / 1000'000
78+ static_cast < uint32_t >( esp_timer_get_time () / 1000'000 )
7979 };
8080
8181#ifndef APB_AMBIENT_TEMPERATURE_SENSOR_NONE
8282 entry.setAmbient (APB::Ambient::Instance.reading ());
8383#endif
8484
85- #if APB_HEATERS_SIZE > 0
86- for (uint8_t i=0 ; i<APB_HEATERS_TEMP_SENSORS ; i++) {
87- entry.heaters [i].set (APB::Heaters ::Instance[i]);
85+ #if APB_PWM_OUTPUTS_SIZE > 0
86+ for (uint8_t i=0 ; i<APB_PWM_OUTPUTS_TEMP_SENSORS ; i++) {
87+ entry.pwmOutputs [i].set (APB::PWMOutputs ::Instance[i]);
8888 }
8989#endif
9090 entry.setPower (PowerMonitor::Instance.status ());
0 commit comments