Skip to content

Commit

Permalink
fix: compilation errors airgradienthq#160
Browse files Browse the repository at this point in the history
  • Loading branch information
hestia committed Jul 25, 2024
1 parent e58ce1c commit a5b32ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/AgApiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "AgConfigure.h"
#include "AirGradient.h"
#include "Libraries/Arduino_JSON/src/Arduino_JSON.h"
#include <WiFiClient.h>
#ifdef ESP8266
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
Expand Down Expand Up @@ -105,9 +106,9 @@ bool AgApiClient::postToServer(String data) {
return true;
}

if (WiFi.isConnected() == false) {
return false;
}
//if (WiFi.isConnected() == false) {
// return false;
//}

String uri =
"http://hw.airgradient.com/sensors/airgradient:" + ag->deviceId() +
Expand Down
8 changes: 5 additions & 3 deletions src/AgConfigure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool Configuration::parse(String data, bool isLocal) {
bool changed = false;

/** Get ConfigurationControl */
String lastCtrl = jconfig[jprop_configurationControl];
const String lastCtrl = jconfig[jprop_configurationControl];
const char *msg = "Monitor set to accept only configuration from the "
"cloud. Use property configurationControl to change.";

Expand Down Expand Up @@ -287,15 +287,17 @@ bool Configuration::parse(String data, bool isLocal) {
}

/** Ignore all configuration value if 'configurationControl' is 'cloud' */
if (jconfig[jprop_configurationControl] ==
const String ctrl = jconfig[jprop_configurationControl];
if (ctrl ==
String(CONFIGURATION_CONTROL_NAME
[ConfigurationControl::ConfigurationControlCloud])) {
failedMessage = String(msg);
jsonInvalid();
return false;
}
} else {
if (jconfig[jprop_configurationControl] ==
const String ctrl = jconfig[jprop_configurationControl];
if (ctrl ==
String(CONFIGURATION_CONTROL_NAME
[ConfigurationControl::ConfigurationControlLocal])) {
failedMessage = "Cloud configure ignored";
Expand Down
5 changes: 2 additions & 3 deletions src/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ bool MqttClient::begin(String uri) {

#ifdef ESP32
/** config esp_mqtt client */
esp_mqtt_client_config_t config = {
.uri = this->uri.c_str(),
};
esp_mqtt_client_config_t config = {};
config.broker.address.uri = this->uri.c_str();

/** init client */
client = esp_mqtt_client_init(&config);
Expand Down

0 comments on commit a5b32ee

Please sign in to comment.