mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-08 12:07:16 +02:00
improved changes from PR #1234
This commit is contained in:
parent
67e8f69ce3
commit
b57e463b92
3 changed files with 7 additions and 9 deletions
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 8
|
||||
#define VERSION_PATCH 9
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -44,8 +44,8 @@ class Communication : public CommQueue<> {
|
|||
if(!valid)
|
||||
return; // empty
|
||||
|
||||
uint16_t timeout = q->iv->ivGen != IV_MI ? (q->iv->mGotFragment && q->iv->mGotLastMsg) ? SINGLEFR_TIMEOUT : DEFAULT_TIMEOUT : MI_TIMEOUT;
|
||||
uint16_t timeout_min = q->iv->ivGen != IV_MI ? q->iv->mGotFragment ? SINGLEFR_TIMEOUT : FRSTMSG_TIMEOUT : MI_TIMEOUT;
|
||||
uint16_t timeout = q->iv->ivGen != IV_MI ? ((q->iv->mGotFragment && q->iv->mGotLastMsg) ? SINGLEFR_TIMEOUT : DEFAULT_TIMEOUT) : MI_TIMEOUT;
|
||||
uint16_t timeout_min = q->iv->ivGen != IV_MI ? ((q->iv->mGotFragment) ? SINGLEFR_TIMEOUT : FRSTMSG_TIMEOUT) : MI_TIMEOUT;
|
||||
bool testMode = false;
|
||||
|
||||
switch(mState) {
|
||||
|
@ -63,7 +63,7 @@ class Communication : public CommQueue<> {
|
|||
testMode = mHeu.getTestModeEnabled();
|
||||
q->iv->mGotFragment = false;
|
||||
q->iv->mGotLastMsg = false;
|
||||
mFirstTry = mFirstTry ? false : ( ( (IV_HM == q->iv->ivGen) || (IV_MI == q->iv->ivGen) ) && (q->iv->isAvailable()) || (millis() < 120000) );
|
||||
mFirstTry = mFirstTry ? false : (((IV_HM == q->iv->ivGen) || (IV_MI == q->iv->ivGen) ) && (q->iv->isAvailable()) || (millis() < 120000));
|
||||
if(NULL == q->iv->radio)
|
||||
cmdDone(true); // can't communicate while radio is not defined!
|
||||
mState = States::START;
|
||||
|
@ -97,8 +97,8 @@ class Communication : public CommQueue<> {
|
|||
if(millis() > mWaitTimeout_min) {
|
||||
if(!q->iv->mGotFragment) { // nothing received yet?
|
||||
if(q->iv->mGotLastMsg) {
|
||||
//mState = States::CHECK_FRAMES;
|
||||
mWaitTimeout = mWaitTimeout_min;
|
||||
//mState = States::CHECK_FRAMES;
|
||||
mWaitTimeout = mWaitTimeout_min;
|
||||
}
|
||||
} else if(mFirstTry) {
|
||||
DPRINT_IVID(DBG_INFO, q->iv->id);
|
||||
|
|
|
@ -309,10 +309,8 @@ class HmRadio : public Radio {
|
|||
}
|
||||
|
||||
inline bool checkIvSerial(uint8_t buf[], Inverter<> *iv) {
|
||||
uint8_t tmp[4];
|
||||
CP_U32_BigEndian(tmp, iv->radioId.u64 >> 8);
|
||||
for(uint8_t i = 0; i < 4; i++) {
|
||||
if(tmp[i] != buf[i])
|
||||
if(buf[3-i] != iv->radioId.b[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue