mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-10 23:46:37 +02:00
Individual rx-channel offset
per inverter (based on serial, but unfortunately not working yet)
This commit is contained in:
parent
19184727bc
commit
1b4b5874df
3 changed files with 9 additions and 4 deletions
|
@ -133,6 +133,7 @@ class Inverter {
|
||||||
bool isConnected; // shows if inverter was successfully identified (fw version and hardware info)
|
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)
|
||||||
int8_t rssi; // RSSI
|
int8_t rssi; // RSSI
|
||||||
uint16_t alarmCnt; // counts the total number of occurred alarms
|
uint16_t alarmCnt; // counts the total number of occurred alarms
|
||||||
uint16_t alarmLastId; // lastId which was received
|
uint16_t alarmLastId; // lastId which was received
|
||||||
|
@ -179,7 +180,6 @@ class Inverter {
|
||||||
tsMaxAcPower = 0;
|
tsMaxAcPower = 0;
|
||||||
|
|
||||||
memset(&radioStatistics, 0, sizeof(statistics_t));
|
memset(&radioStatistics, 0, sizeof(statistics_t));
|
||||||
memset(heuristics.txRfQuality, -6, 5);
|
|
||||||
|
|
||||||
memset(mOffYD, 0, sizeof(float) * 6);
|
memset(mOffYD, 0, sizeof(float) * 6);
|
||||||
memset(mLastYD, 0, sizeof(float) * 6);
|
memset(mLastYD, 0, sizeof(float) * 6);
|
||||||
|
|
|
@ -154,11 +154,11 @@ class HmRadio : public Radio {
|
||||||
mLastIv->mAckCount++;
|
mLastIv->mAckCount++;
|
||||||
|
|
||||||
//mRxChIdx = (mTxChIdx + 2) % RF_CHANNELS;
|
//mRxChIdx = (mTxChIdx + 2) % RF_CHANNELS;
|
||||||
mRxChIdx = (mTxChIdx + 3) % RF_CHANNELS;
|
mRxChIdx = (mTxChIdx + mLastIv->rxOffset) % RF_CHANNELS;
|
||||||
mNrf24->setChannel(mRfChLst[mRxChIdx]);
|
mNrf24->setChannel(mRfChLst[mRxChIdx]);
|
||||||
mNrf24->startListening();
|
mNrf24->startListening();
|
||||||
mTimeslotStart = millis();
|
mTimeslotStart = millis();
|
||||||
tempRxChIdx = mRxChIdx;
|
tempRxChIdx = mRxChIdx; // might be better to start off with one channel less?
|
||||||
rxPendular = false;
|
rxPendular = false;
|
||||||
mNRFloopChannels = (mLastIv->ivGen == IV_MI);
|
mNRFloopChannels = (mLastIv->ivGen == IV_MI);
|
||||||
|
|
||||||
|
@ -369,7 +369,10 @@ class HmRadio : public Radio {
|
||||||
DBGPRINT(String(mRfChLst[mTxChIdx]));
|
DBGPRINT(String(mRfChLst[mTxChIdx]));
|
||||||
DBGPRINT(F(", "));
|
DBGPRINT(F(", "));
|
||||||
DBGPRINT(String(mTxRetriesNext));
|
DBGPRINT(String(mTxRetriesNext));
|
||||||
DBGPRINT(F(" retries | "));
|
//DBGPRINT(F(" retries | "));
|
||||||
|
DBGPRINT(F(" ret., rx offset: "));
|
||||||
|
DBGPRINT(String(iv->rxOffset));
|
||||||
|
DBGPRINT(F(" | "));
|
||||||
if(*mPrintWholeTrace) {
|
if(*mPrintWholeTrace) {
|
||||||
if(*mPrivacyMode)
|
if(*mPrivacyMode)
|
||||||
ah::dumpBuf(mTxBuf, len, 1, 4);
|
ah::dumpBuf(mTxBuf, len, 1, 4);
|
||||||
|
|
|
@ -28,6 +28,8 @@ class HmSystem {
|
||||||
iv->config = &mInverter[0].generalConfig->iv[id];
|
iv->config = &mInverter[0].generalConfig->iv[id];
|
||||||
DPRINT(DBG_VERBOSE, "SERIAL: " + String(iv->config->serial.b[5], HEX));
|
DPRINT(DBG_VERBOSE, "SERIAL: " + String(iv->config->serial.b[5], HEX));
|
||||||
DPRINTLN(DBG_VERBOSE, " " + String(iv->config->serial.b[4], HEX));
|
DPRINTLN(DBG_VERBOSE, " " + String(iv->config->serial.b[4], HEX));
|
||||||
|
//iv->rxOffset = 5 - (iv->config->serial.b[2] % 5); //RF_CHANNELS;
|
||||||
|
iv->rxOffset = (iv->config->serial.b[1] % 5); //RF_CHANNELS;
|
||||||
if((iv->config->serial.b[5] == 0x11) || (iv->config->serial.b[5] == 0x10)) {
|
if((iv->config->serial.b[5] == 0x11) || (iv->config->serial.b[5] == 0x10)) {
|
||||||
switch(iv->config->serial.b[4]) {
|
switch(iv->config->serial.b[4]) {
|
||||||
case 0x24: // HMS-500
|
case 0x24: // HMS-500
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue