Skip to content

Commit b85f61b

Browse files
committed
Heater -> PWMOutput. Also added type field.
1 parent 3aaa034 commit b85f61b

9 files changed

Lines changed: 99 additions & 90 deletions

File tree

src/commandparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "commandparser.h"
2-
#include "heater.h"
2+
#include "pwm_output.h"
33
#include <ArduinoLog.h>
44
#define LOG_SCOPE "APB::CommandParser "
55

src/history.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ APB::History::History() {
1313

1414

1515
#if APB_HEATERS_SIZE > 0
16-
void APB::History::Entry::Heater::set(const APB::Heater &heater) {
16+
void APB::History::Entry::PWMOutput::set(const APB::PWMOutput &heater) {
1717
temperatureHundredth = static_cast<int16_t>(heater.temperature().value_or(-100.0) * 100.0);
1818
duty = heater.active() ? heater.duty() : 0;
1919
}

src/history.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include "ambient/ambient.h"
1212
#include "powermonitor.h"
13-
#include "heater.h"
13+
#include "pwm_output.h"
1414
#include "utils.h"
1515

1616
#define HISTORY_ENTRY_SIZE 256
@@ -22,14 +22,14 @@ class History {
2222
History();
2323
struct Entry {
2424
#if APB_HEATERS_SIZE > 0
25-
struct Heater {
25+
struct PWMOutput {
2626
int16_t temperatureHundredth;
2727
uint8_t duty;
28-
void set(const APB::Heater &heater);
28+
void set(const APB::PWMOutput &heater);
2929
float getTemperature() const { return static_cast<float>(temperatureHundredth) / 100.0; }
3030
float getDuty() const { return static_cast<float>(duty); }
3131
};
32-
std::array<Heater, APB_HEATERS_TEMP_SENSORS> heaters;
32+
std::array<PWMOutput, APB_HEATERS_TEMP_SENSORS> heaters;
3333
#endif
3434
uint32_t secondsFromBoot;
3535
#ifndef APB_AMBIENT_TEMPERATURE_SENSOR_NONE

src/influxdb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ APB::InfluxDb &APB::InfluxDb::Instance = *new APB::InfluxDb{};
77
#include "settings.h"
88
#include "wifimanager.h"
99
#include "powermonitor.h"
10-
#include "heater.h"
10+
#include "pwm_output.h"
1111
#include "ambient/ambient.h"
1212
#include <StreamString.h>
1313
#include <ArduinoLog.h>
@@ -76,7 +76,7 @@ void APB::InfluxDb::sendData() {
7676
}
7777
#endif
7878
#if APB_HEATERS_SIZE > 0
79-
for(Heater &heater : Heaters::Instance) {
79+
for(PWMOutput &heater : Heaters::Instance) {
8080
heatersSensor.clearFields();
8181
heatersSensor.addField("index", heater.index());
8282
if(heater.temperature().has_value()) {

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "settings.h"
1313
#include "ambient/ambient.h"
14-
#include "heater.h"
14+
#include "pwm_output.h"
1515
#include "powermonitor.h"
1616
#include <Wire.h>
1717
#include <LittleFS.h>
@@ -95,7 +95,7 @@ void setup() {
9595
Wire.setClock(100000);
9696
APB::Ambient::Instance.setup(scheduler);
9797
APB::PowerMonitor::Instance.setup(scheduler);
98-
std::for_each(APB::Heaters::Instance.begin(), APB::Heaters::Instance.end(), [i=0](APB::Heater &heater) mutable { heater.setup(i++, scheduler); });
98+
std::for_each(APB::Heaters::Instance.begin(), APB::Heaters::Instance.end(), [i=0](APB::PWMOutput &heater) mutable { heater.setup(i++, scheduler); });
9999

100100
webServer.setup();
101101
ArduinoOTAManager::Instance.setup([](const char*s) { Log.warning(s); }, std::bind(&fs::LittleFSFS::end, &LittleFS));

0 commit comments

Comments
 (0)