mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 11:17:11 +02:00
bug fix esp8266
This commit is contained in:
parent
ded734fa8b
commit
124cbf6ba2
2 changed files with 12 additions and 9 deletions
11
src/app.cpp
11
src/app.cpp
|
@ -64,8 +64,10 @@ void app::setup() {
|
||||||
mSys.addInverter(i, [this](Inverter<> *iv) {
|
mSys.addInverter(i, [this](Inverter<> *iv) {
|
||||||
if((IV_MI == iv->ivGen) || (IV_HM == iv->ivGen))
|
if((IV_MI == iv->ivGen) || (IV_HM == iv->ivGen))
|
||||||
iv->radio = &mNrfRadio;
|
iv->radio = &mNrfRadio;
|
||||||
|
#if defined(ESP32)
|
||||||
else if((IV_HMS == iv->ivGen) || (IV_HMT == iv->ivGen))
|
else if((IV_HMS == iv->ivGen) || (IV_HMT == iv->ivGen))
|
||||||
iv->radio = &mCmtRadio;
|
iv->radio = &mCmtRadio;
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (mConfig->nrf.enabled) {
|
if (mConfig->nrf.enabled) {
|
||||||
|
@ -116,6 +118,7 @@ void app::setup() {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void app::loop(void) {
|
void app::loop(void) {
|
||||||
ah::Scheduler::loop();
|
ah::Scheduler::loop();
|
||||||
|
bool processPayload = false;
|
||||||
|
|
||||||
if (mNrfRadio.loop() && mConfig->nrf.enabled) {
|
if (mNrfRadio.loop() && mConfig->nrf.enabled) {
|
||||||
while (!mNrfRadio.mBufCtrl.empty()) {
|
while (!mNrfRadio.mBufCtrl.empty()) {
|
||||||
|
@ -142,7 +145,7 @@ void app::loop(void) {
|
||||||
mNrfRadio.mBufCtrl.pop();
|
mNrfRadio.mBufCtrl.pop();
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
mPayload.process(true);
|
processPayload = true;
|
||||||
mMiPayload.process(true);
|
mMiPayload.process(true);
|
||||||
}
|
}
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
|
@ -167,9 +170,13 @@ void app::loop(void) {
|
||||||
mCmtRadio.mBufCtrl.pop();
|
mCmtRadio.mBufCtrl.pop();
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
mPayload.process(false); //true
|
processPayload = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(processPayload)
|
||||||
|
mPayload.process(true);
|
||||||
|
|
||||||
mPayload.loop();
|
mPayload.loop();
|
||||||
mMiPayload.loop();
|
mMiPayload.loop();
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ class Inverter {
|
||||||
uint8_t channels; // number of PV channels (1-4)
|
uint8_t channels; // number of PV channels (1-4)
|
||||||
record_t<REC_TYP> recordMeas; // structure for measured values
|
record_t<REC_TYP> recordMeas; // structure for measured values
|
||||||
record_t<REC_TYP> recordInfo; // structure for info values
|
record_t<REC_TYP> recordInfo; // structure for info values
|
||||||
record_t<REC_TYP> recordHwInfo; // structure for simple (hardware) info values
|
record_t<REC_TYP> recordHwInfo; // structure for simple (hardware) info values
|
||||||
record_t<REC_TYP> recordConfig; // structure for system config values
|
record_t<REC_TYP> recordConfig; // structure for system config values
|
||||||
record_t<REC_TYP> recordAlarm; // structure for alarm values
|
record_t<REC_TYP> recordAlarm; // structure for alarm values
|
||||||
bool initialized; // needed to check if the inverter was correctly added (ESP32 specific - union types are never null)
|
bool initialized; // needed to check if the inverter was correctly added (ESP32 specific - union types are never null)
|
||||||
|
@ -169,7 +169,6 @@ class Inverter {
|
||||||
mDevControlRequest = false;
|
mDevControlRequest = false;
|
||||||
devControlCmd = InitDataState;
|
devControlCmd = InitDataState;
|
||||||
initialized = false;
|
initialized = false;
|
||||||
//lastAlarmMsg = "nothing";
|
|
||||||
alarmMesIndex = 0;
|
alarmMesIndex = 0;
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
status = InverterStatus::OFF;
|
status = InverterStatus::OFF;
|
||||||
|
@ -364,9 +363,6 @@ class Inverter {
|
||||||
}
|
}
|
||||||
else if (rec->assign == AlarmDataAssignment) {
|
else if (rec->assign == AlarmDataAssignment) {
|
||||||
DPRINTLN(DBG_DEBUG, "add alarm");
|
DPRINTLN(DBG_DEBUG, "add alarm");
|
||||||
//if (getPosByChFld(0, FLD_LAST_ALARM_CODE, rec) == pos){
|
|
||||||
// lastAlarmMsg = getAlarmStr(rec->record[pos]);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DPRINTLN(DBG_WARN, F("add with unknown assignment"));
|
DPRINTLN(DBG_WARN, F("add with unknown assignment"));
|
||||||
|
@ -499,8 +495,8 @@ class Inverter {
|
||||||
record_t<> *getRecordStruct(uint8_t cmd) {
|
record_t<> *getRecordStruct(uint8_t cmd) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case RealTimeRunData_Debug: return &recordMeas; // 11 = 0x0b
|
case RealTimeRunData_Debug: return &recordMeas; // 11 = 0x0b
|
||||||
case InverterDevInform_Simple: return &recordHwInfo; // 0 = 0x00
|
case InverterDevInform_Simple: return &recordHwInfo; // 0 = 0x00
|
||||||
case InverterDevInform_All: return &recordInfo; // 1 = 0x01
|
case InverterDevInform_All: return &recordInfo; // 1 = 0x01
|
||||||
case SystemConfigPara: return &recordConfig; // 5 = 0x05
|
case SystemConfigPara: return &recordConfig; // 5 = 0x05
|
||||||
case AlarmData: return &recordAlarm; // 17 = 0x11
|
case AlarmData: return &recordAlarm; // 17 = 0x11
|
||||||
default: break;
|
default: break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue