Browse Source

0.8.70

* prevent sending commands to inverter which isn't active #1387
pull/1402/head
lumapu 12 months ago
parent
commit
ae799b4c21
  1. 12
      .github/workflows/compile_development.yml
  2. 3
      src/CHANGES.md
  3. 1
      src/hm/Communication.h
  4. 29
      src/hm/hmInverter.h

12
.github/workflows/compile_development.yml

@ -12,7 +12,7 @@ jobs:
if: github.repository == 'lumapu/ahoy' && github.ref_name == 'development03' if: github.repository == 'lumapu/ahoy' && github.ref_name == 'development03'
continue-on-error: true continue-on-error: true
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
build-en: build-en:
needs: check needs: check
@ -32,7 +32,7 @@ jobs:
- opendtufusion - opendtufusion
- opendtufusion-ethernet - opendtufusion-ethernet
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: benjlevesque/short-sha@v2.1 - uses: benjlevesque/short-sha@v2.1
id: short-sha id: short-sha
with: with:
@ -53,7 +53,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4.3.0 uses: actions/setup-python@v5
with: with:
python-version: "3.x" python-version: "3.x"
@ -92,7 +92,7 @@ jobs:
- opendtufusion-de - opendtufusion-de
- opendtufusion-ethernet-de - opendtufusion-ethernet-de
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: benjlevesque/short-sha@v2.1 - uses: benjlevesque/short-sha@v2.1
id: short-sha id: short-sha
with: with:
@ -113,7 +113,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4.3.0 uses: actions/setup-python@v5
with: with:
python-version: "3.x" python-version: "3.x"
@ -138,7 +138,7 @@ jobs:
needs: [build-en, build-de] needs: [build-en, build-de]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
#- name: Copy boot_app0.bin #- name: Copy boot_app0.bin
# run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusion/ota.bin # run: cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin src/.pio/build/opendtufusion/ota.bin

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Development Changes # Development Changes
## 0.8.70 - 2024-02-01
* prevent sending commands to inverter which isn't active #1387
## 0.8.69 - 2024-01-31 ## 0.8.69 - 2024-01-31
* merge PR: Dynamic retries, pendular first rx chan #1394 * merge PR: Dynamic retries, pendular first rx chan #1394

1
src/hm/Communication.h

@ -681,7 +681,6 @@ class Communication : public CommQueue<> {
for (uint8_t i = 0; i < 5; i++) { for (uint8_t i = 0; i < 5; i++) {
q->iv->setValue(i, rec, (float) ((p->packet[(12+2*i)] << 8) + p->packet[(13+2*i)])/1); q->iv->setValue(i, rec, (float) ((p->packet[(12+2*i)] << 8) + p->packet[(13+2*i)])/1);
} }
q->iv->isConnected = true;
if(*mSerialDebug) { if(*mSerialDebug) {
DPRINT_IVID(DBG_INFO, q->iv->id); DPRINT_IVID(DBG_INFO, q->iv->id);
DBGPRINT(F("HW_VER is ")); DBGPRINT(F("HW_VER is "));

29
src/hm/hmInverter.h

@ -130,7 +130,6 @@ class Inverter {
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 isConnected; // shows if inverter was successfully identified (fw version and hardware info)
InverterStatus status; // indicates the current inverter status InverterStatus status; // indicates the current inverter status
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
uint8_t rxOffset; // holds the default channel offset between tx and rx channel (nRF only) uint8_t rxOffset; // holds the default channel offset between tx and rx channel (nRF only)
@ -166,7 +165,6 @@ class Inverter {
mDevControlRequest = false; mDevControlRequest = false;
devControlCmd = InitDataState; devControlCmd = InitDataState;
alarmMesIndex = 0; alarmMesIndex = 0;
isConnected = false;
status = InverterStatus::OFF; status = InverterStatus::OFF;
alarmCnt = 0; alarmCnt = 0;
alarmLastId = 0; alarmLastId = 0;
@ -186,7 +184,10 @@ class Inverter {
void tickSend(std::function<void(uint8_t cmd, bool isDevControl)> cb) { void tickSend(std::function<void(uint8_t cmd, bool isDevControl)> cb) {
if(mDevControlRequest) { if(mDevControlRequest) {
if(InverterStatus::PRODUCING == status)
cb(devControlCmd, true); cb(devControlCmd, true);
else
DPRINTLN(DBG_WARN, F("Inverter is not avail"));
mDevControlRequest = false; mDevControlRequest = false;
} else if (IV_MI != ivGen) { // HM / HMS / HMT } else if (IV_MI != ivGen) { // HM / HMS / HMT
mGetLossInterval++; mGetLossInterval++;
@ -262,8 +263,7 @@ class Inverter {
break; break;
} }
return (pos >= rec->length) ? 0xff : pos; return (pos >= rec->length) ? 0xff : pos;
} } else
else
return 0xff; return 0xff;
} }
@ -290,18 +290,18 @@ class Inverter {
} }
bool setDevControlRequest(uint8_t cmd) { bool setDevControlRequest(uint8_t cmd) {
if(isConnected) { if(InverterStatus::PRODUCING == status) {
mDevControlRequest = true; mDevControlRequest = true;
devControlCmd = cmd; devControlCmd = cmd;
//app->triggerTickSend(); // done in RestApi.h, because of "chicken-and-egg problem ;-)" //app->triggerTickSend(); // done in RestApi.h, because of "chicken-and-egg problem ;-)"
} }
return isConnected; return (InverterStatus::PRODUCING == status);
} }
bool setDevCommand(uint8_t cmd) { bool setDevCommand(uint8_t cmd) {
if(isConnected) if(InverterStatus::PRODUCING == status)
devControlCmd = cmd; devControlCmd = cmd;
return isConnected; return (InverterStatus::PRODUCING == status);
} }
void addValue(uint8_t pos, uint8_t buf[], record_t<> *rec) { void addValue(uint8_t pos, uint8_t buf[], record_t<> *rec) {
@ -318,6 +318,7 @@ class Inverter {
val <<= 8; val <<= 8;
val |= buf[ptr]; val |= buf[ptr];
} while(++ptr != end); } while(++ptr != end);
if ((FLD_T == rec->assign[pos].fieldId) || (FLD_Q == rec->assign[pos].fieldId) || (FLD_PF == rec->assign[pos].fieldId)) { if ((FLD_T == rec->assign[pos].fieldId) || (FLD_Q == rec->assign[pos].fieldId) || (FLD_PF == rec->assign[pos].fieldId)) {
// temperature, Qvar, and power factor are a signed values // temperature, Qvar, and power factor are a signed values
rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div); rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div);
@ -350,12 +351,10 @@ class Inverter {
DBGPRINTLN(String(alarmMesIndex)); DBGPRINTLN(String(alarmMesIndex));
} }
} }
} } else {
else {
if (rec->assign == InfoAssignment) { if (rec->assign == InfoAssignment) {
DPRINTLN(DBG_DEBUG, "add info"); DPRINTLN(DBG_DEBUG, "add info");
// eg. fw version ... // eg. fw version ...
isConnected = true;
} else if (rec->assign == SimpleInfoAssignment) { } else if (rec->assign == SimpleInfoAssignment) {
DPRINTLN(DBG_DEBUG, "add simple info"); DPRINTLN(DBG_DEBUG, "add simple info");
// eg. hw version ... // eg. hw version ...
@ -371,8 +370,7 @@ class Inverter {
} else } else
DPRINTLN(DBG_WARN, F("add with unknown assignment")); DPRINTLN(DBG_WARN, F("add with unknown assignment"));
} }
} } else
else
DPRINTLN(DBG_ERROR, F("addValue: assignment not found with cmd 0x")); DPRINTLN(DBG_ERROR, F("addValue: assignment not found with cmd 0x"));
// update status state-machine // update status state-machine
@ -396,12 +394,12 @@ class Inverter {
if((rec->assign[pos].ch == channel) && (rec->assign[pos].fieldId == fieldId)) if((rec->assign[pos].ch == channel) && (rec->assign[pos].fieldId == fieldId))
break; break;
} }
if(pos >= rec->length) if(pos >= rec->length)
return 0; return 0;
return rec->record[pos]; return rec->record[pos];
} } else
else
return 0; return 0;
} }
@ -477,6 +475,7 @@ class Inverter {
else if(InverterStatus::PRODUCING == status) else if(InverterStatus::PRODUCING == status)
status = InverterStatus::WAS_PRODUCING; status = InverterStatus::WAS_PRODUCING;
} }
return producing; return producing;
} }

Loading…
Cancel
Save