Browse Source

* try to avoid exceptions, added yield

* try to fix DNS problems
pull/9/head
lumapu 2 years ago
parent
commit
169bf8c7c8
  1. 5
      tools/esp8266/app.cpp
  2. 2
      tools/esp8266/defines.h
  3. 4
      tools/esp8266/main.cpp

5
tools/esp8266/app.cpp

@ -150,7 +150,8 @@ void app::loop(void) {
inv = mSys->getInverterByPos(i); inv = mSys->getInverterByPos(i);
if(NULL != inv) { if(NULL != inv) {
mSys->Radio.sendTimePacket(inv->radioId.u64, mTimestamp); mSys->Radio.sendTimePacket(inv->radioId.u64, mTimestamp);
delay(20); yield();
delay(100);
} }
} }
} }
@ -171,6 +172,7 @@ void app::loop(void) {
snprintf(val, 10, "%.3f", mSys->getValue(iv, i)); snprintf(val, 10, "%.3f", mSys->getValue(iv, i));
mMqtt.sendMsg(topic, val); mMqtt.sendMsg(topic, val);
delay(20); delay(20);
yield();
} }
} }
} }
@ -187,6 +189,7 @@ void app::loop(void) {
snprintf(val, 10, "%.3f %s", mSys->getValue(iv, i), mSys->getUnit(iv, i)); snprintf(val, 10, "%.3f %s", mSys->getValue(iv, i), mSys->getUnit(iv, i));
Serial.println(String(topic) + ": " + String(val)); Serial.println(String(topic) + ": " + String(val));
} }
yield();
} }
} }
} }

2
tools/esp8266/defines.h

@ -25,7 +25,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 7 #define VERSION_PATCH 8
//------------------------------------- //-------------------------------------

4
tools/esp8266/main.cpp

@ -43,8 +43,6 @@ void Main::setup(const char *ssid, const char *pwd, uint32_t timeout) {
mWeb->onNotFound (std::bind(&Main::showNotFound, this)); mWeb->onNotFound (std::bind(&Main::showNotFound, this));
startAp = getConfig(); startAp = getConfig();
if(String(mDeviceName) != "")
WiFi.hostname(mDeviceName);
if(false == startAp) if(false == startAp)
startAp = setupStation(timeout); startAp = setupStation(timeout);
@ -126,6 +124,8 @@ bool Main::setupStation(uint32_t timeout) {
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(mStationSsid, mStationPwd); WiFi.begin(mStationSsid, mStationPwd);
if(String(mDeviceName) != "")
WiFi.hostname(mDeviceName);
delay(5000); delay(5000);
Serial.println("wait for network"); Serial.println("wait for network");

Loading…
Cancel
Save