mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-05 04:01:41 +02:00
changed sunrise / sunset calculation, angle is now -3.5
instead of original -0.83
improved scheduler (removed -1 from `reload`) #483 improved reboot flag in `app.h` fixed #493 no MQTT payload once display is defined
This commit is contained in:
parent
c8c8b99957
commit
ea6a9c155c
12 changed files with 62 additions and 61 deletions
23
src/app.cpp
23
src/app.cpp
|
@ -30,8 +30,6 @@ void app::setup() {
|
|||
mSettings.getPtr(mConfig);
|
||||
DPRINTLN(DBG_INFO, F("Settings valid: ") + String((mSettings.getValid()) ? F("true") : F("false")));
|
||||
|
||||
|
||||
everySec(std::bind(&app::tickSecond, this));
|
||||
every(std::bind(&app::tickSend, this), mConfig->nrf.sendInterval);
|
||||
#if !defined(AP_ONLY)
|
||||
once(std::bind(&app::tickNtpUpdate, this), 2);
|
||||
|
@ -44,6 +42,8 @@ void app::setup() {
|
|||
mSys = new HmSystemType();
|
||||
mSys->enableDebug();
|
||||
mSys->setup(mConfig->nrf.amplifierPower, mConfig->nrf.pinIrq, mConfig->nrf.pinCe, mConfig->nrf.pinCs);
|
||||
mPayload.addListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1));
|
||||
|
||||
|
||||
#if !defined(AP_ONLY)
|
||||
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, mSys, &mTimestamp, &mSunrise, &mSunset);
|
||||
|
@ -62,7 +62,6 @@ void app::setup() {
|
|||
// when WiFi is in client mode, then enable mqtt broker
|
||||
#if !defined(AP_ONLY)
|
||||
if (mConfig->mqtt.broker[0] > 0) {
|
||||
mPayload.addListener(std::bind(&PubMqttType::payloadEventListener, &mMqtt, std::placeholders::_1));
|
||||
everySec(std::bind(&PubMqttType::tickerSecond, &mMqtt));
|
||||
everyMin(std::bind(&PubMqttType::tickerMinute, &mMqtt));
|
||||
mMqtt.setSubscriptionCb(std::bind(&app::mqttSubRxCb, this, std::placeholders::_1));
|
||||
|
@ -75,19 +74,10 @@ void app::setup() {
|
|||
everySec(std::bind(&WebType::tickSecond, &mWeb));
|
||||
|
||||
mApi.setup(this, mSys, mWeb.getWebSrvPtr(), mConfig);
|
||||
/*mApi.registerCb(apiCbScanNetworks, std::bind(&app::scanAvailNetworks, this));
|
||||
#if !defined(AP_ONLY)
|
||||
mApi.registerCb(apiCbMqttTxCnt, std::bind(&PubMqttType::getTxCnt, &mMqtt));
|
||||
mApi.registerCb(apiCbMqttRxCnt, std::bind(&PubMqttType::getRxCnt, &mMqtt));
|
||||
mApi.registerCb(apiCbMqttIsCon, std::bind(&PubMqttType::isConnected, &mMqtt));
|
||||
mApi.registerCb(apiCbMqttDiscvry, std::bind(&PubMqttType::sendDiscoveryConfig, &mMqtt));
|
||||
//mApi.registerCb(apiCbMqttDiscvry, std::bind(&app::setMqttDiscoveryFlag, this));
|
||||
#endif*/
|
||||
|
||||
// Plugins
|
||||
#if defined(ENA_NOKIA) || defined(ENA_SSD1306)
|
||||
mMonoDisplay.setup(mSys, &mTimestamp);
|
||||
mPayload.addListener(std::bind(&MonoDisplayType::payloadEventListener, &mMonoDisplay, std::placeholders::_1));
|
||||
everySec(std::bind(&MonoDisplayType::tickerSecond, &mMonoDisplay));
|
||||
#endif
|
||||
|
||||
|
@ -107,11 +97,6 @@ void app::loop(void) {
|
|||
|
||||
mWeb.loop();
|
||||
|
||||
if (mFlagSendDiscoveryConfig) {
|
||||
mFlagSendDiscoveryConfig = false;
|
||||
mMqtt.sendDiscoveryConfig();
|
||||
}
|
||||
|
||||
mSys->Radio.loop();
|
||||
|
||||
yield();
|
||||
|
@ -253,10 +238,6 @@ void app::handleIntr(void) {
|
|||
void app::resetSystem(void) {
|
||||
snprintf(mVersion, 12, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
|
||||
|
||||
mShouldReboot = false;
|
||||
mUpdateNtp = false;
|
||||
mFlagSendDiscoveryConfig = false;
|
||||
|
||||
#ifdef AP_ONLY
|
||||
mTimestamp = 1;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue