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. 31
      src/hm/hmInverter.h

12
.github/workflows/compile_development.yml

@ -12,7 +12,7 @@ jobs:
if: github.repository == 'lumapu/ahoy' && github.ref_name == 'development03'
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
build-en:
needs: check
@ -32,7 +32,7 @@ jobs:
- opendtufusion
- opendtufusion-ethernet
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
@ -53,7 +53,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Setup Python
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: "3.x"
@ -92,7 +92,7 @@ jobs:
- opendtufusion-de
- opendtufusion-ethernet-de
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: benjlevesque/short-sha@v2.1
id: short-sha
with:
@ -113,7 +113,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Setup Python
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: "3.x"
@ -138,7 +138,7 @@ jobs:
needs: [build-en, build-de]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
#- name: Copy boot_app0.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
## 0.8.70 - 2024-02-01
* prevent sending commands to inverter which isn't active #1387
## 0.8.69 - 2024-01-31
* 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++) {
q->iv->setValue(i, rec, (float) ((p->packet[(12+2*i)] << 8) + p->packet[(13+2*i)])/1);
}
q->iv->isConnected = true;
if(*mSerialDebug) {
DPRINT_IVID(DBG_INFO, q->iv->id);
DBGPRINT(F("HW_VER is "));

31
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> recordConfig; // structure for system config 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
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)
@ -166,7 +165,6 @@ class Inverter {
mDevControlRequest = false;
devControlCmd = InitDataState;
alarmMesIndex = 0;
isConnected = false;
status = InverterStatus::OFF;
alarmCnt = 0;
alarmLastId = 0;
@ -186,7 +184,10 @@ class Inverter {
void tickSend(std::function<void(uint8_t cmd, bool isDevControl)> cb) {
if(mDevControlRequest) {
cb(devControlCmd, true);
if(InverterStatus::PRODUCING == status)
cb(devControlCmd, true);
else
DPRINTLN(DBG_WARN, F("Inverter is not avail"));
mDevControlRequest = false;
} else if (IV_MI != ivGen) { // HM / HMS / HMT
mGetLossInterval++;
@ -262,8 +263,7 @@ class Inverter {
break;
}
return (pos >= rec->length) ? 0xff : pos;
}
else
} else
return 0xff;
}
@ -290,18 +290,18 @@ class Inverter {
}
bool setDevControlRequest(uint8_t cmd) {
if(isConnected) {
if(InverterStatus::PRODUCING == status) {
mDevControlRequest = true;
devControlCmd = cmd;
//app->triggerTickSend(); // done in RestApi.h, because of "chicken-and-egg problem ;-)"
}
return isConnected;
return (InverterStatus::PRODUCING == status);
}
bool setDevCommand(uint8_t cmd) {
if(isConnected)
if(InverterStatus::PRODUCING == status)
devControlCmd = cmd;
return isConnected;
return (InverterStatus::PRODUCING == status);
}
void addValue(uint8_t pos, uint8_t buf[], record_t<> *rec) {
@ -318,6 +318,7 @@ class Inverter {
val <<= 8;
val |= buf[ptr];
} while(++ptr != end);
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
rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div);
@ -350,12 +351,10 @@ class Inverter {
DBGPRINTLN(String(alarmMesIndex));
}
}
}
else {
} else {
if (rec->assign == InfoAssignment) {
DPRINTLN(DBG_DEBUG, "add info");
// eg. fw version ...
isConnected = true;
} else if (rec->assign == SimpleInfoAssignment) {
DPRINTLN(DBG_DEBUG, "add simple info");
// eg. hw version ...
@ -371,8 +370,7 @@ class Inverter {
} else
DPRINTLN(DBG_WARN, F("add with unknown assignment"));
}
}
else
} else
DPRINTLN(DBG_ERROR, F("addValue: assignment not found with cmd 0x"));
// update status state-machine
@ -396,12 +394,12 @@ class Inverter {
if((rec->assign[pos].ch == channel) && (rec->assign[pos].fieldId == fieldId))
break;
}
if(pos >= rec->length)
return 0;
return rec->record[pos];
}
else
} else
return 0;
}
@ -477,6 +475,7 @@ class Inverter {
else if(InverterStatus::PRODUCING == status)
status = InverterStatus::WAS_PRODUCING;
}
return producing;
}

Loading…
Cancel
Save