Skip to content

Commit

Permalink
Merge pull request #465 from visualapproach/development_v4
Browse files Browse the repository at this point in the history
Development v4
  • Loading branch information
visualapproach authored Mar 12, 2023
2 parents 28f6fa9 + 9982fc3 commit b13645d
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 33 deletions.
Binary file modified Build-instructions-Bestway-WiFi-remote.pdf
Binary file not shown.
Binary file modified Code/fw/firmware.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion Code/fw/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-03-10-1230
2023-03-12-1600
2 changes: 1 addition & 1 deletion Code/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <WiFi.h>
#endif
#define DEVICE_NAME "layzspa"
#define FW_VERSION "2023-03-10-1230"
#define FW_VERSION "2023-03-12-1600"

// String FW_VERSION = String(__DATE__) + "-" + __TIME__ + "-beta";
#define HA_PREFIX "homeassistant"
Expand Down
30 changes: 2 additions & 28 deletions Code/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,18 @@ void setup()
char stack;
stack_start = &stack;

bwc.setup();
bwc.loop();
Serial.begin(115200);
Serial.println(F("\nStart"));
Serial.printf("Heap: %d, frag: %d\n", ESP.getFreeHeap(), ESP.getHeapFragmentation());

periodicTimer.attach(periodicTimerInterval, []{ periodicTimerFlag = true; });
// delayed mqtt start
startComplete.attach(60, []{ if(useMqtt) enableMqtt = true; startComplete.detach(); });

// update webpage every 2 seconds. (will also be updated on state changes)
updateWSTimer.attach(2.0, []{ sendWSFlag = true; });

// when NTP time is valid we save bootlog.txt and this timer stops
bootlogTimer.attach(5, []{ if(DateTime.isTimeValid()) {bwc.saveRebootInfo(); bootlogTimer.detach();} });

bwc.setup();
// needs to be loaded here for reading files
// LittleFS.begin();
loadWifi();
loadWebConfig();
startWiFi();
Expand All @@ -87,29 +82,8 @@ Serial.printf("Heap: %d, frag: %d\n", ESP.getFreeHeap(), ESP.getHeapFragmentatio
bwc.print(FW_VERSION);
Serial.println(F("End of setup()"));
heap_water_mark = ESP.getFreeHeap();

// setClock();

}

// void setClock() {
// // Set time via NTP, as required for x.509 validation
// configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");
// Serial.print("Waiting for NTP time sync: ");
// time_t now = time(nullptr);
// while (now < 8 * 3600 * 2) {
// delay(500);
// Serial.print(".");
// now = time(nullptr);
// }
// Serial.println("");
// struct tm timeinfo;
// gmtime_r(&now, &timeinfo);
// Serial.print("Current time: ");
// Serial.print(asctime(&timeinfo));
// }


void loop()
{
uint32_t freeheap = ESP.getFreeHeap();
Expand Down
4 changes: 1 addition & 3 deletions Code/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <WiFiClientSecure.h>
#include "certs.h"
// #include "certs.h"
#include <CertStoreBearSSL.h>
BearSSL::CertStore certStore;
#include <time.h>
Expand Down Expand Up @@ -81,8 +81,6 @@ bool enableMqtt = false;
/** used for handleAUX() */
bool runonce = true;

// void setClock();

void sendWS();
String getOtherInfo();
void sendMQTT();
Expand Down

0 comments on commit b13645d

Please sign in to comment.