mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-30 02:36:20 +02:00
0.7.1
* enabled power limit control for HMS / HMT devices * changed NRF24 lib version back to 1.4.5 because of compile problems for EPS8266
This commit is contained in:
parent
a1c00bdc01
commit
f0848ecfb4
6 changed files with 47 additions and 37 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.7.1 - 2023-06-05
|
||||||
|
* enabled power limit control for HMS / HMT devices
|
||||||
|
* changed NRF24 lib version back to 1.4.5 because of compile problems for EPS8266
|
||||||
|
|
||||||
## 0.7.0 - 2023-06-04
|
## 0.7.0 - 2023-06-04
|
||||||
* HMS / HMT support for ESP32 devices
|
* HMS / HMT support for ESP32 devices
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <RF24.h>
|
#include <RF24.h>
|
||||||
#include <RF24_config.h>
|
|
||||||
|
|
||||||
#include "appInterface.h"
|
#include "appInterface.h"
|
||||||
#include "config/settings.h"
|
#include "config/settings.h"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 7
|
#define VERSION_MINOR 7
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 1
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -83,7 +83,7 @@ class HmsPayload {
|
||||||
if ((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) // only process HMS inverters
|
if ((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) // only process HMS inverters
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//if(!highPrio) {
|
if(!highPrio) {
|
||||||
if (mPayload[iv->id].requested) {
|
if (mPayload[iv->id].requested) {
|
||||||
if (!mPayload[iv->id].complete)
|
if (!mPayload[iv->id].complete)
|
||||||
process(false); // no retransmit
|
process(false); // no retransmit
|
||||||
|
@ -106,52 +106,41 @@ class HmsPayload {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
reset(iv->id);
|
reset(iv->id);
|
||||||
mPayload[iv->id].requested = true;
|
mPayload[iv->id].requested = true;
|
||||||
|
|
||||||
yield();
|
yield();
|
||||||
if (mSerialDebug) {
|
if (mSerialDebug) {
|
||||||
DPRINT(DBG_INFO, F("(#"));
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(String(iv->id));
|
|
||||||
DBGPRINT(F(") Requesting Inv SN "));
|
DBGPRINT(F(") Requesting Inv SN "));
|
||||||
DBGPRINTLN(String(iv->config->serial.u64, HEX));
|
DBGPRINTLN(String(iv->config->serial.u64, HEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (iv->getDevControlRequest()) {
|
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
|
||||||
|
if (iv->getDevControlRequest()) {
|
||||||
if (mSerialDebug) {
|
if (mSerialDebug) {
|
||||||
DPRINT(DBG_INFO, F("(#"));
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(String(iv->id));
|
|
||||||
DBGPRINT(F(") Devcontrol request 0x"));
|
DBGPRINT(F(") Devcontrol request 0x"));
|
||||||
DBGPRINT(String(iv->devControlCmd, HEX));
|
DBGPRINT(String(iv->devControlCmd, HEX));
|
||||||
DBGPRINT(F(" power limit "));
|
DBGPRINT(F(" power limit "));
|
||||||
DBGPRINTLN(String(iv->powerLimit[0]));
|
DBGPRINTLN(String(iv->powerLimit[0]));
|
||||||
}
|
}
|
||||||
mRadio->sendControlPacket(iv->radioId.u64, iv->devControlCmd, iv->powerLimit, false);
|
mRadio->sendControlPacket(&iv->radioId.u64, iv->devControlCmd, iv->powerLimit, false);
|
||||||
mPayload[iv->id].txCmd = iv->devControlCmd;
|
mPayload[iv->id].txCmd = iv->devControlCmd;
|
||||||
//iv->clearCmdQueue();
|
//iv->clearCmdQueue();
|
||||||
//iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
//iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
||||||
} else {
|
} else if(((rec->ts + HMS_TIMEOUT_SEC) < *mTimestamp) && (mIvCmd56Cnt[iv->id] < 3)) {
|
||||||
uint8_t cmd = iv->getQueuedCmd();
|
|
||||||
DPRINT(DBG_INFO, F("(#"));
|
|
||||||
DBGPRINT(String(iv->id));
|
|
||||||
DBGPRINT(F(") prepareDevInformCmd")); // + String(cmd, HEX));
|
|
||||||
mRadio->prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
|
|
||||||
mPayload[iv->id].txCmd = cmd;
|
|
||||||
}*/
|
|
||||||
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
|
|
||||||
if(((rec->ts + HMS_TIMEOUT_SEC) < *mTimestamp) && (mIvCmd56Cnt[iv->id] < 3)) {
|
|
||||||
//mRadio->switchFrequency(&iv->radioId.u64, 863000, WORK_FREQ_KHZ);
|
|
||||||
mRadio->switchFrequency(&iv->radioId.u64, HOY_BOOT_FREQ_KHZ, WORK_FREQ_KHZ);
|
mRadio->switchFrequency(&iv->radioId.u64, HOY_BOOT_FREQ_KHZ, WORK_FREQ_KHZ);
|
||||||
mIvCmd56Cnt[iv->id]++;
|
mIvCmd56Cnt[iv->id]++;
|
||||||
} else {
|
} else {
|
||||||
if(++mIvCmd56Cnt[iv->id] == 10)
|
if(++mIvCmd56Cnt[iv->id] == 10)
|
||||||
mIvCmd56Cnt[iv->id] = 0;
|
mIvCmd56Cnt[iv->id] = 0;
|
||||||
uint8_t cmd = iv->getQueuedCmd();
|
uint8_t cmd = iv->getQueuedCmd();
|
||||||
DPRINT(DBG_INFO, F("(#"));
|
DPRINT_IVID(DBG_INFO, iv->id);
|
||||||
DBGPRINT(String(iv->id));
|
DBGPRINT(F("prepareDevInformCmd 0x"));
|
||||||
DBGPRINTLN(F(") prepareDevInformCmd")); // + String(cmd, HEX));
|
DBGHEXLN(cmd);
|
||||||
mRadio->prepareDevInformCmd(&iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
|
mRadio->prepareDevInformCmd(&iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, false);
|
||||||
mPayload[iv->id].txCmd = cmd;
|
mPayload[iv->id].txCmd = cmd;
|
||||||
}
|
}
|
||||||
|
@ -181,15 +170,15 @@ class HmsPayload {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /*else if (p->packet[0] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
|
} else if (p->data[1] == (TX_REQ_DEVCONTROL + ALL_FRAMES)) { // response from dev control command
|
||||||
DPRINTLN(DBG_DEBUG, F("Response from devcontrol request received"));
|
DPRINTLN(DBG_DEBUG, F("Response from devcontrol request received"));
|
||||||
|
|
||||||
mPayload[iv->id].txId = p->packet[0];
|
mPayload[iv->id].txId = p->data[1];
|
||||||
iv->clearDevControlRequest();
|
iv->clearDevControlRequest();
|
||||||
|
|
||||||
if ((p->packet[12] == ActivePowerContr) && (p->packet[13] == 0x00)) {
|
if ((p->data[13] == ActivePowerContr) && (p->data[14] == 0x00)) {
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if((p->packet[10] == 0x00) && (p->packet[11] == 0x00))
|
if((p->data[11] == 0x00) && (p->data[12] == 0x00))
|
||||||
mApp->setMqttPowerLimitAck(iv);
|
mApp->setMqttPowerLimitAck(iv);
|
||||||
else
|
else
|
||||||
ok = false;
|
ok = false;
|
||||||
|
@ -206,7 +195,7 @@ class HmsPayload {
|
||||||
iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
iv->enqueCommand<InfoCommand>(SystemConfigPara); // read back power limit
|
||||||
}
|
}
|
||||||
iv->devControlCmd = Init;
|
iv->devControlCmd = Init;
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void process(bool retransmit) {
|
void process(bool retransmit) {
|
||||||
|
@ -235,10 +224,10 @@ class HmsPayload {
|
||||||
// This is required to prevent retransmissions without answer.
|
// This is required to prevent retransmissions without answer.
|
||||||
DPRINTLN(DBG_INFO, F("Prevent retransmit on Restart / CleanState_LockAndAlarm..."));
|
DPRINTLN(DBG_INFO, F("Prevent retransmit on Restart / CleanState_LockAndAlarm..."));
|
||||||
mPayload[iv->id].retransmits = mMaxRetrans;
|
mPayload[iv->id].retransmits = mMaxRetrans;
|
||||||
} /*else if(iv->devControlCmd == ActivePowerContr) {
|
} else if(iv->devControlCmd == ActivePowerContr) {
|
||||||
DPRINTLN(DBG_INFO, F("retransmit power limit"));
|
DPRINTLN(DBG_INFO, F("retransmit power limit"));
|
||||||
mRadio->sendControlPacket(iv->radioId.u64, iv->devControlCmd, iv->powerLimit, true);
|
mRadio->sendControlPacket(&iv->radioId.u64, iv->devControlCmd, iv->powerLimit, true);
|
||||||
}*/ else {
|
} else {
|
||||||
if(false == mPayload[iv->id].gotFragment) {
|
if(false == mPayload[iv->id].gotFragment) {
|
||||||
|
|
||||||
//DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
//DPRINTLN(DBG_WARN, F("nothing received: Request Complete Retransmit"));
|
||||||
|
|
|
@ -63,6 +63,24 @@ class CmtRadio {
|
||||||
mSerialDebug = true;
|
mSerialDebug = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendControlPacket(const uint64_t *ivId, uint8_t cmd, uint16_t *data, bool isRetransmit) {
|
||||||
|
DPRINT(DBG_INFO, F("sendControlPacket cmd: 0x"));
|
||||||
|
DBGHEXLN(cmd);
|
||||||
|
initPacket(ivId, TX_REQ_DEVCONTROL, SINGLE_FRAME);
|
||||||
|
uint8_t cnt = 10;
|
||||||
|
|
||||||
|
mTxBuf[cnt++] = cmd; // cmd -> 0 on, 1 off, 2 restart, 11 active power, 12 reactive power, 13 power factor
|
||||||
|
mTxBuf[cnt++] = 0x00;
|
||||||
|
if(cmd >= ActivePowerContr && cmd <= PFSet) { // ActivePowerContr, ReactivePowerContr, PFSet
|
||||||
|
mTxBuf[cnt++] = ((data[0] * 10) >> 8) & 0xff; // power limit
|
||||||
|
mTxBuf[cnt++] = ((data[0] * 10) ) & 0xff; // power limit
|
||||||
|
mTxBuf[cnt++] = ((data[1] ) >> 8) & 0xff; // setting for persistens handlings
|
||||||
|
mTxBuf[cnt++] = ((data[1] ) ) & 0xff; // setting for persistens handling
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(cnt, isRetransmit);
|
||||||
|
}
|
||||||
|
|
||||||
bool switchFrequency(const uint64_t *ivId, uint32_t fromkHz, uint32_t tokHz) {
|
bool switchFrequency(const uint64_t *ivId, uint32_t fromkHz, uint32_t tokHz) {
|
||||||
uint8_t fromCh = mCmt.freq2Chan(fromkHz);
|
uint8_t fromCh = mCmt.freq2Chan(fromkHz);
|
||||||
uint8_t toCh = mCmt.freq2Chan(tokHz);
|
uint8_t toCh = mCmt.freq2Chan(tokHz);
|
||||||
|
|
|
@ -24,7 +24,7 @@ extra_scripts =
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/yubox-node-org/ESPAsyncWebServer
|
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||||
nrf24/RF24 @ ^1.4.5
|
nrf24/RF24 @ 1.4.5
|
||||||
paulstoffregen/Time @ ^1.6.1
|
paulstoffregen/Time @ ^1.6.1
|
||||||
https://github.com/bertmelis/espMqttClient#v1.4.2
|
https://github.com/bertmelis/espMqttClient#v1.4.2
|
||||||
bblanchon/ArduinoJson @ ^6.21.2
|
bblanchon/ArduinoJson @ ^6.21.2
|
||||||
|
@ -37,7 +37,7 @@ lib_deps =
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = esp12e
|
board = esp12e
|
||||||
board_build.f_cpu = 80000000L
|
board_build.f_cpu = 80000000L
|
||||||
build_flags = -D RELEASE
|
build_flags = -D RELEASE -std=gnu++17
|
||||||
;-Wl,-Map,output.map
|
;-Wl,-Map,output.map
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
;default ; Remove typical terminal control codes from input
|
;default ; Remove typical terminal control codes from input
|
||||||
|
@ -50,7 +50,7 @@ monitor_filters =
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = esp12e
|
board = esp12e
|
||||||
board_build.f_cpu = 80000000L
|
board_build.f_cpu = 80000000L
|
||||||
build_flags = -D RELEASE -DENABLE_PROMETHEUS_EP
|
build_flags = -D RELEASE -std=gnu++17 -DENABLE_PROMETHEUS_EP
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
;default ; Remove typical terminal control codes from input
|
;default ; Remove typical terminal control codes from input
|
||||||
;time ; Add timestamp with milliseconds for each new line
|
;time ; Add timestamp with milliseconds for each new line
|
||||||
|
@ -61,7 +61,7 @@ monitor_filters =
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = esp12e
|
board = esp12e
|
||||||
board_build.f_cpu = 80000000L
|
board_build.f_cpu = 80000000L
|
||||||
build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
|
build_flags = -DDEBUG_LEVEL=DBG_DEBUG -std=gnu++17 -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial -DPIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
|
||||||
build_type = debug
|
build_type = debug
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
;default ; Remove typical terminal control codes from input
|
;default ; Remove typical terminal control codes from input
|
||||||
|
@ -73,7 +73,7 @@ platform = espressif8266
|
||||||
board = esp8285
|
board = esp8285
|
||||||
board_build.ldscript = eagle.flash.1m64.ld
|
board_build.ldscript = eagle.flash.1m64.ld
|
||||||
board_build.f_cpu = 80000000L
|
board_build.f_cpu = 80000000L
|
||||||
build_flags = -D RELEASE
|
build_flags = -D RELEASE -std=gnu++17
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
;default ; Remove typical terminal control codes from input
|
;default ; Remove typical terminal control codes from input
|
||||||
time ; Add timestamp with milliseconds for each new line
|
time ; Add timestamp with milliseconds for each new line
|
||||||
|
|
Loading…
Add table
Reference in a new issue