Browse Source

basic implementation of improv

pull/1027/head
lumapu 2 years ago
parent
commit
bfae0e0def
  1. 3
      src/app.cpp
  2. 16
      src/app.h
  3. 2
      src/hm/hmRadio.h

3
src/app.cpp

@ -82,6 +82,8 @@ void app::setup() {
mPubSerial.setup(mConfig, &mSys, &mTimestamp); mPubSerial.setup(mConfig, &mSys, &mTimestamp);
mImprov.setup(mConfig->sys.deviceName, mVersion);
regularTickers(); regularTickers();
@ -169,6 +171,7 @@ void app::regularTickers(void) {
if (mConfig->plugin.display.type != 0) if (mConfig->plugin.display.type != 0)
everySec(std::bind(&DisplayType::tickerSecond, &mDisplay), "disp"); everySec(std::bind(&DisplayType::tickerSecond, &mDisplay), "disp");
every(std::bind(&PubSerialType::tick, &mPubSerial), mConfig->serial.interval, "uart"); every(std::bind(&PubSerialType::tick, &mPubSerial), mConfig->serial.interval, "uart");
everySec(std::bind(&Improv::tickSerial, &mImprov), "impro");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

16
src/app.h

@ -22,6 +22,7 @@
#include "utils/crc.h" #include "utils/crc.h"
#include "utils/dbg.h" #include "utils/dbg.h"
#include "utils/scheduler.h" #include "utils/scheduler.h"
#include "utils/improv.h"
#include "web/RestApi.h" #include "web/RestApi.h"
#include "web/web.h" #include "web/web.h"
#include "wifi/ahoywifi.h" #include "wifi/ahoywifi.h"
@ -243,20 +244,6 @@ class app : public IApp, public ah::Scheduler {
void tickMinute(void); void tickMinute(void);
void tickZeroValues(void); void tickZeroValues(void);
void tickMidnight(void); void tickMidnight(void);
/*void tickSerial(void) {
if(Serial.available() == 0)
return;
uint8_t buf[80];
uint8_t len = Serial.readBytes(buf, 80);
DPRINTLN(DBG_INFO, "got serial data, len: " + String(len));
for(uint8_t i = 0; i < len; i++) {
if((0 != i) && (i % 8 == 0))
DBGPRINTLN("");
DBGPRINT(String(buf[i], HEX) + " ");
}
DBGPRINTLN("");
}*/
innerLoopCb mInnerLoopCb; innerLoopCb mInnerLoopCb;
@ -269,6 +256,7 @@ class app : public IApp, public ah::Scheduler {
PayloadType mPayload; PayloadType mPayload;
MiPayloadType mMiPayload; MiPayloadType mMiPayload;
PubSerialType mPubSerial; PubSerialType mPubSerial;
Improv mImprov;
char mVersion[12]; char mVersion[12];
settings mSettings; settings mSettings;

2
src/hm/hmRadio.h

@ -1,6 +1,6 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// 2023 Ahoy, https://github.com/lumpapu/ahoy // 2023 Ahoy, https://github.com/lumpapu/ahoy
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ // Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef __RADIO_H__ #ifndef __RADIO_H__

Loading…
Cancel
Save