mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-27 15:37:16 +02:00
Fix changes to other examples
This commit is contained in:
@ -55,7 +55,7 @@ CC BY-SA 4.0 Attribution-ShareAlike 4.0 International License
|
||||
static AirGradient ag(DIY_BASIC);
|
||||
static Configuration configuration(Serial);
|
||||
static AgApiClient apiClient(Serial, configuration);
|
||||
static Measurements measurements;
|
||||
static Measurements measurements(configuration);
|
||||
static OledDisplay oledDisplay(configuration, measurements, Serial);
|
||||
static StateMachine stateMachine(oledDisplay, Serial, measurements,
|
||||
configuration);
|
||||
@ -124,6 +124,7 @@ void setup() {
|
||||
apiClient.setAirGradient(&ag);
|
||||
openMetrics.setAirGradient(&ag);
|
||||
localServer.setAirGraident(&ag);
|
||||
measurements.setAirGradient(&ag);
|
||||
|
||||
/** Example set custom API root URL */
|
||||
// apiClient.setApiRoot("https://example.custom.api");
|
||||
@ -316,7 +317,7 @@ static void mqttHandle(void) {
|
||||
}
|
||||
|
||||
if (mqttClient.isConnected()) {
|
||||
String payload = measurements.toString(true, fwMode, wifiConnector.RSSI(), ag, configuration);
|
||||
String payload = measurements.toString(true, fwMode, wifiConnector.RSSI());
|
||||
String topic = "airgradient/readings/" + ag.deviceId();
|
||||
if (mqttClient.publish(topic.c_str(), payload.c_str(), payload.length())) {
|
||||
Serial.println("MQTT sync success");
|
||||
@ -527,7 +528,7 @@ static void sendDataToServer(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), ag, configuration);
|
||||
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI());
|
||||
if (apiClient.postToServer(syncData)) {
|
||||
Serial.println();
|
||||
Serial.println(
|
||||
|
@ -53,7 +53,7 @@ void LocalServer::_GET_metrics(void) {
|
||||
}
|
||||
|
||||
void LocalServer::_GET_measure(void) {
|
||||
String toSend = measure.toString(true, fwMode, wifiConnector.RSSI(), *ag, config);
|
||||
String toSend = measure.toString(true, fwMode, wifiConnector.RSSI());
|
||||
server.send(200, "application/json", toSend);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ String OpenMetrics::getPayload(void) {
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
pm01 = measure.get(Measurements::PM01);
|
||||
float correctedPm = measure.getCorrectedPM25(*ag, config, false, 1);
|
||||
float correctedPm = measure.getCorrectedPM25(false, 1);
|
||||
pm25 = round(correctedPm);
|
||||
pm10 = measure.get(Measurements::PM10);
|
||||
pm03PCount = measure.get(Measurements::PM03_PC);
|
||||
|
Reference in New Issue
Block a user