Browse Source

0.7.66 - 2023-10-04

* prepared PA-Level for CMT
* removed settings for number of retransmits, its fixed to `5` now
* added parentheses to have a excactly defined behaviour
pull/1219/head
lumapu 1 year ago
parent
commit
3e9d6b8900
  1. 5
      src/CHANGES.md
  2. 4
      src/app.cpp
  3. 5
      src/config/config.h
  4. 4
      src/config/settings.h
  5. 2
      src/defines.h
  6. 4
      src/hm/hmPayload.h
  7. 4
      src/hm/miPayload.h
  8. 4
      src/hm/radio.h
  9. 64
      src/hms/cmt2300a.h
  10. 1
      src/web/RestApi.h
  11. 6
      src/web/html/setup.html
  12. 2
      src/web/web.h

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes
## 0.7.66 - 2023-10-04
* prepared PA-Level for CMT
* removed settings for number of retransmits, its fixed to `5` now
* added parentheses to have a excactly defined behaviour
## 0.7.65 - 2023-10-02
* MI control command review #1197

4
src/app.cpp

@ -71,11 +71,11 @@ void app::setup() {
});
}
mPayload.setup(this, &mSys, mConfig->nrf.maxRetransPerPyld, &mTimestamp);
mPayload.setup(this, &mSys, &mTimestamp);
mPayload.enableSerialDebug(mConfig->serial.debug);
mPayload.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1, std::placeholders::_2));
if (mConfig->nrf.enabled) {
mMiPayload.setup(this, &mSys, mConfig->nrf.maxRetransPerPyld, &mTimestamp);
mMiPayload.setup(this, &mSys, &mTimestamp);
mMiPayload.enableSerialDebug(mConfig->serial.debug);
mMiPayload.addPayloadListener(std::bind(&app::payloadEventListener, this, std::placeholders::_1, std::placeholders::_2));
}

5
src/config/config.h

@ -149,7 +149,7 @@
#define SERIAL_INTERVAL 5
// default send interval
#define SEND_INTERVAL 30
#define SEND_INTERVAL 15
// maximum human readable inverter name length
#define MAX_NAME_LENGTH 16
@ -160,9 +160,6 @@
// maximum total payload buffers (must be greater than the number of received frame fragments)
#define MAX_PAYLOAD_ENTRIES 10
// maximum requests for retransmits per payload (per inverter)
#define DEF_MAX_RETRANS_PER_PYLD 5
// number of seconds since last successful response, before inverter is marked inactive
#define INVERTER_INACT_THRES_SEC 5*60

4
src/config/settings.h

@ -82,7 +82,6 @@ typedef struct {
typedef struct {
bool enabled;
uint16_t sendInterval;
uint8_t maxRetransPerPyld;
uint8_t pinCs;
uint8_t pinCe;
uint8_t pinIrq;
@ -385,7 +384,6 @@ class settings {
snprintf(mCfg.sys.deviceName, DEVNAME_LEN, DEF_DEVICE_NAME);
mCfg.nrf.sendInterval = SEND_INTERVAL;
mCfg.nrf.maxRetransPerPyld = DEF_MAX_RETRANS_PER_PYLD;
mCfg.nrf.pinCs = DEF_NRF_CS_PIN;
mCfg.nrf.pinCe = DEF_NRF_CE_PIN;
mCfg.nrf.pinIrq = DEF_NRF_IRQ_PIN;
@ -502,7 +500,6 @@ class settings {
void jsonNrf(JsonObject obj, bool set = false) {
if(set) {
obj[F("intvl")] = mCfg.nrf.sendInterval;
obj[F("maxRetry")] = mCfg.nrf.maxRetransPerPyld;
obj[F("cs")] = mCfg.nrf.pinCs;
obj[F("ce")] = mCfg.nrf.pinCe;
obj[F("irq")] = mCfg.nrf.pinIrq;
@ -513,7 +510,6 @@ class settings {
obj[F("en")] = (bool) mCfg.nrf.enabled;
} else {
getVal<uint16_t>(obj, F("intvl"), &mCfg.nrf.sendInterval);
getVal<uint8_t>(obj, F("maxRetry"), &mCfg.nrf.maxRetransPerPyld);
getVal<uint8_t>(obj, F("cs"), &mCfg.nrf.pinCs);
getVal<uint8_t>(obj, F("ce"), &mCfg.nrf.pinCe);
getVal<uint8_t>(obj, F("irq"), &mCfg.nrf.pinIrq);

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 65
#define VERSION_PATCH 66
//-------------------------------------
typedef struct {

4
src/hm/hmPayload.h

@ -44,10 +44,10 @@ class HmPayload {
public:
HmPayload() {}
void setup(IApp *app, HMSYSTEM *sys, uint8_t maxRetransmits, uint32_t *timestamp) {
void setup(IApp *app, HMSYSTEM *sys, uint32_t *timestamp) {
mApp = app;
mSys = sys;
mMaxRetrans = maxRetransmits;
mMaxRetrans = 5;
mTimestamp = timestamp;
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
reset(i);

4
src/hm/miPayload.h

@ -44,10 +44,10 @@ class MiPayload {
public:
MiPayload() {}
void setup(IApp *app, HMSYSTEM *sys, uint8_t maxRetransmits, uint32_t *timestamp) {
void setup(IApp *app, HMSYSTEM *sys, uint32_t *timestamp) {
mApp = app;
mSys = sys;
mMaxRetrans = maxRetransmits;
mMaxRetrans = 5;
mTimestamp = timestamp;
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
reset(i, false, true);

4
src/hm/radio.h

@ -66,9 +66,9 @@ class Radio {
void updateCrcs(uint8_t *len, bool appendCrc16=true) {
// append crc's
if (appendCrc16 && (*len > 10)) {
if (appendCrc16 && ((*len) > 10)) {
// crc control data
uint16_t crc = ah::crc16(&mTxBuf[10], *len - 10);
uint16_t crc = ah::crc16(&mTxBuf[10], (*len) - 10);
mTxBuf[(*len)++] = (crc >> 8) & 0xff;
mTxBuf[(*len)++] = (crc ) & 0xff;
}

64
src/hms/cmt2300a.h

@ -25,6 +25,10 @@
#define CMT2300A_MASK_CHIP_MODE_STA 0x0F
#define CMT2300A_CUS_CMT10 0x09
#define CMT2300A_CUS_TX5 0x59
#define CMT2300A_CUS_TX8 0x5C
#define CMT2300A_CUS_TX9 0x5D
#define CMT2300A_CUS_TX10 0x5E
#define CMT2300A_CUS_MODE_CTL 0x60 // [7] go_switch
// [6] go_tx
@ -153,6 +157,42 @@
#define CMT2300A_MASK_TX_DONE_FLG 0x08
#define CMT2300A_MASK_PKT_OK_FLG 0x01
// this list and the TX5, TX10 registers were compiled from the output of
// HopeRF RFPDK Tool v1.54
static uint8_t paLevelList[31][2] PROGMEM = {
{0x17, 0x01}, // -10dBm
{0x1a, 0x01}, // -09dBm
{0x1d, 0x01}, // -08dBm
{0x21, 0x01}, // -07dBm
{0x25, 0x01}, // -06dBm
{0x29, 0x01}, // -05dBm
{0x2d, 0x01}, // -04dBm
{0x33, 0x01}, // -03dBm
{0x39, 0x02}, // -02dBm
{0x41, 0x02}, // -01dBm
{0x4b, 0x02}, // 00dBm
{0x56, 0x03}, // 01dBm
{0x63, 0x03}, // 02dBm
{0x71, 0x04}, // 03dBm
{0x80, 0x04}, // 04dBm
{0x22, 0x01}, // 05dBm
{0x27, 0x04}, // 06dBm
{0x2c, 0x05}, // 07dBm
{0x31, 0x06}, // 08dBm
{0x38, 0x06}, // 09dBm
{0x3f, 0x07}, // 10dBm
{0x48, 0x08}, // 11dBm
{0x52, 0x09}, // 12dBm
{0x5d, 0x0b}, // 13dBm
{0x6a, 0x0c}, // 14dBm
{0x79, 0x0d}, // 15dBm
{0x46, 0x10}, // 16dBm
{0x51, 0x10}, // 17dBm
{0x60, 0x12}, // 18dBm
{0x71, 0x14}, // 19dBm
{0x8c, 0x1c} // 20dBm
};
// default CMT parameters
static uint8_t cmtConfig[0x60] PROGMEM {
// 0x00 - 0x0f -- RSSI offset +- 0 and 13dBm
@ -168,11 +208,11 @@ static uint8_t cmtConfig[0x60] PROGMEM {
0x10, 0x00, 0xB4, 0x00, 0x00, 0x01, 0x00, 0x00,
0x12, 0x1E, 0x00, 0xAA, 0x06, 0x00, 0x00, 0x00,
// 0x40 - 0x4f
0x00, 0x48, 0x5A, 0x48, 0x4D, 0x01, 0x1D, 0x00,
0x00, 0x48, 0x5A, 0x48, 0x4D, 0x01, 0x1F, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00, 0x60,
// 0x50 - 0x5f
0xFF, 0x00, 0x00, 0x1F, 0x10, 0x70, 0x4D, 0x06,
0x00, 0x07, 0x50, 0x00, 0x42, 0x0C, 0x3F, 0x7F // - TX 13dBm
0x00, 0x07, 0x50, 0x00, 0x5D, 0x0B, 0x3F, 0x7F // - TX 13dBm
};
@ -391,6 +431,26 @@ class Cmt2300a {
return HOY_BASE_FREQ_KHZ + (mCurCh * FREQ_STEP_KHZ);
}
void setPaLevel(int8_t level) {
if(level < -10)
level = -10;
if(level > 20)
level = 20;
level += 10; // unsigned value
if(level >= 15) {
mSpi.writeReg(CMT2300A_CUS_TX5, 0x07);
mSpi.writeReg(CMT2300A_CUS_TX10, 0x3f);
} else {
mSpi.writeReg(CMT2300A_CUS_TX5, 0x13);
mSpi.writeReg(CMT2300A_CUS_TX10, 0x18);
}
mSpi.writeReg(CMT2300A_CUS_TX8, paLevelList[level][0]);
mSpi.writeReg(CMT2300A_CUS_TX9, paLevelList[level][1]);
}
private:
void init() {
mTxPending = false;

1
src/web/RestApi.h

@ -356,7 +356,6 @@ class RestApi {
}
}
obj[F("interval")] = String(mConfig->nrf.sendInterval);
obj[F("retries")] = String(mConfig->nrf.maxRetransPerPyld);
obj[F("max_num_inverters")] = MAX_NUM_INVERTERS;
obj[F("rstMid")] = (bool)mConfig->inst.rstYieldMidNight;
obj[F("rstNotAvail")] = (bool)mConfig->inst.rstValsNotAvail;

6
src/web/html/setup.html

@ -30,7 +30,7 @@
</fieldset>
<fieldset class="mb-4">
<legend class="des">System Config</legend>
<p class="des">Pinout</p>
<p class="des">Status LEDs</p>
<div id="pinout"></div>
<p class="des">Radio (NRF24L01+)</p>
@ -736,11 +736,11 @@
function parsePinout(obj, type, system) {
var e = document.getElementById("pinout");
pins = [['led0', 'pinLed0'], ['led1', 'pinLed1']];
pins = [['led0', 'pinLed0', 'At least one inverter is producing'], ['led1', 'pinLed1', 'MqTT connected']];
for(p of pins) {
e.append(
ml("div", {class: "row mb-3"}, [
ml("div", {class: "col-12 col-sm-3 my-2"}, p[0].toUpperCase()),
ml("div", {class: "col-12 col-sm-3 my-2"}, p[2]),
ml("div", {class: "col-12 col-sm-9"},
sel(p[1], ("ESP8266" == type) ? esp8266pins : ("ESP32-S3" == system["chip_model"]) ? esp32s3pins : esp32pins, obj[p[0]])
)

2
src/web/web.h

@ -527,8 +527,6 @@ class Web {
if (request->arg("invInterval") != "")
mConfig->nrf.sendInterval = request->arg("invInterval").toInt();
if (request->arg("invRetry") != "")
mConfig->nrf.maxRetransPerPyld = request->arg("invRetry").toInt();
mConfig->inst.rstYieldMidNight = (request->arg("invRstMid") == "on");
mConfig->inst.rstValsCommStop = (request->arg("invRstComStop") == "on");
mConfig->inst.rstValsNotAvail = (request->arg("invRstNotAvail") == "on");

Loading…
Cancel
Save