mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-15 00:46:31 +02:00
Merge pull request #121 from airgradienthq/hotfix/led-bar-power-up-test-wifi-connection-still-perform
Fix issue: LED bar test presssed but WiFi connection still perform
This commit is contained in:
@ -34,7 +34,8 @@ void AgApiClient::begin(void) {
|
||||
*/
|
||||
bool AgApiClient::fetchServerConfiguration(void) {
|
||||
if (config.getConfigurationControl() ==
|
||||
ConfigurationControl::ConfigurationControlLocal) {
|
||||
ConfigurationControl::ConfigurationControlLocal ||
|
||||
config.isOfflineMode()) {
|
||||
logWarning("Ignore fetch server configuration");
|
||||
|
||||
// Clear server configuration failed flag, cause it's ignore but not
|
||||
|
@ -1193,7 +1193,7 @@ int Configuration::getDisplayBrightness(void) {
|
||||
|
||||
bool Configuration::isOfflineMode(void) {
|
||||
bool offline = jconfig[jprop_offlineMode];
|
||||
return offline;
|
||||
return (offline || _offlineMode);
|
||||
}
|
||||
|
||||
void Configuration::setOfflineMode(bool offline) {
|
||||
@ -1202,6 +1202,10 @@ void Configuration::setOfflineMode(bool offline) {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
void Configuration::setOfflineModeWithoutSave(bool offline) {
|
||||
_offlineMode = offline;
|
||||
}
|
||||
|
||||
bool Configuration::isDisplayBrightnessChanged(void) {
|
||||
bool changed = displayBrightnessChanged;
|
||||
displayBrightnessChanged = false;
|
||||
|
@ -17,6 +17,7 @@ private:
|
||||
bool ledBarBrightnessChanged = false;
|
||||
bool displayBrightnessChanged = false;
|
||||
String otaNewFirmwareVersion;
|
||||
bool _offlineMode = false;
|
||||
|
||||
AirGradient* ag;
|
||||
|
||||
@ -80,6 +81,7 @@ public:
|
||||
String newFirmwareVersion(void);
|
||||
bool isOfflineMode(void);
|
||||
void setOfflineMode(bool offline);
|
||||
void setOfflineModeWithoutSave(bool offline);
|
||||
};
|
||||
|
||||
#endif /** _AG_CONFIG_H_ */
|
||||
|
@ -345,3 +345,16 @@ int WifiConnector::RSSI(void) { return WiFi.RSSI(); }
|
||||
* @return String
|
||||
*/
|
||||
String WifiConnector::localIpStr(void) { return WiFi.localIP().toString(); }
|
||||
|
||||
/**
|
||||
* @brief Get status that wifi has configurated
|
||||
*
|
||||
* @return true Configurated
|
||||
* @return false Not Configurated
|
||||
*/
|
||||
bool WifiConnector::hasConfigurated(void) {
|
||||
if (WiFi.SSID().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
void reset(void);
|
||||
int RSSI(void);
|
||||
String localIpStr(void);
|
||||
bool hasConfigurated(void);
|
||||
};
|
||||
|
||||
#endif /** _AG_WIFI_CONNECTOR_H_ */
|
||||
|
Reference in New Issue
Block a user