Skip to content

Commit

Permalink
when no wifi than wait only 100000 ms
Browse files Browse the repository at this point in the history
set sleep time to 2 min
define backend port to 80
  • Loading branch information
error23 committed Jul 14, 2021
1 parent 3c7d741 commit 0ca37c3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/core/Defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define MAX_JSON_DOCUMENT_SIZE 1024

#define BACKEND_HOST "192.168.0.1"
#define BACKEND_PORT 8080
#define BACKEND_PORT 80
#define BACKEND_BASE_PATH "/"

#define BACKEND_USER_USERNAME "defineme"
Expand Down
2 changes: 1 addition & 1 deletion include/core/SmartWifi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace CrowOs {
void reconnect();

/**
* Wait for connection for 130000ms than fail
* Wait for connection for 100000 ms than fail
*/
const bool waitUntilReconnect();

Expand Down
7 changes: 4 additions & 3 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OneButton homeButton(BUTTON_A_PIN, true);
OneButton upButton(BUTTON_B_PIN, true);

/** Time helper */
Time timeHelper(60, 30);
Time timeHelper(120, 30);

/** Led helper */
Led ledHelper;
Expand Down Expand Up @@ -141,7 +141,7 @@ void sleep() {
sleeping = true;
if(LOG_DEBUG) Serial.println("Debug : [Main] sleep sleeping = true");
saveFeatureDataToServer(false);
killCurrentFeature();
if(currentFeature != NULL) killCurrentFeature();
M5.Axp.SetSleep();
smartWifi.disconnect();
}
Expand All @@ -159,7 +159,7 @@ void wakeUp() {
M5.Lcd.setSwapBytes(true);
screenHelper.setUp();
smartWifi.connect();
currentFeature = startFeature(currentFeatureIndex);
if(currentFeatureIndex != -1) currentFeature = startFeature(currentFeatureIndex);

sleeping = false;
}
Expand All @@ -173,6 +173,7 @@ void initialiseFeatureData() {

if(!smartWifi.waitUntilReconnect()) {
screenHelper.showError("Init failed !!", 10000);
return;
}

DynamicJsonDocument responseBody(MAX_JSON_DOCUMENT_SIZE * (FeatureFactory::featureFactories.size() + 1));
Expand Down
4 changes: 2 additions & 2 deletions src/core/SmartWifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace CrowOs {
}

/**
* Wait for connection for 130000ms than fail
* Wait for connection for 100000 ms than fail
*/
const bool SmartWifi::waitUntilReconnect() {

Expand All @@ -84,7 +84,7 @@ namespace CrowOs {
while(!checkStatus()) {

reconnect();
if(millis() - now >= 130000) {
if(millis() - now >= 100000) {
if(LOG_INFO) Serial.println("Info : [SmartWifi] waitUntilReconnect failed");
return false;
}
Expand Down

0 comments on commit 0ca37c3

Please sign in to comment.