mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-01 11:16:20 +02:00
improve communication
This commit is contained in:
parent
60bc9dd552
commit
7afd0b80fe
1 changed files with 13 additions and 7 deletions
|
@ -41,19 +41,22 @@ class CmtRadio {
|
||||||
bool loop() {
|
bool loop() {
|
||||||
mCmt.loop();
|
mCmt.loop();
|
||||||
|
|
||||||
if(0x00 != mIrqRcvd)
|
if((!mIrqRcvd) && (!mRqstGetRx))
|
||||||
return false;
|
return false;
|
||||||
mIrqRcvd--;
|
|
||||||
getRx();
|
getRx();
|
||||||
mCmt.goRx();
|
if(CMT_SUCCESS == mCmt.goRx()) {
|
||||||
|
mIrqRcvd = false;
|
||||||
|
mRqstGetRx = false;
|
||||||
return true;
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tickSecond() {
|
void tickSecond() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleIntr(void) {
|
void handleIntr(void) {
|
||||||
mIrqRcvd++;
|
mIrqRcvd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableDebug() {
|
void enableDebug() {
|
||||||
|
@ -130,7 +133,8 @@ class CmtRadio {
|
||||||
mSendCnt = 0;
|
mSendCnt = 0;
|
||||||
mRetransmits = 0;
|
mRetransmits = 0;
|
||||||
mSerialDebug = false;
|
mSerialDebug = false;
|
||||||
mIrqRcvd = 0;
|
mIrqRcvd = false;
|
||||||
|
mRqstGetRx = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void sendSwitchChCmd(const uint64_t *ivId, uint8_t ch) {
|
inline void sendSwitchChCmd(const uint64_t *ivId, uint8_t ch) {
|
||||||
|
@ -149,6 +153,7 @@ class CmtRadio {
|
||||||
mTxBuf[12] = ch;
|
mTxBuf[12] = ch;
|
||||||
mTxBuf[13] = 0x14;
|
mTxBuf[13] = 0x14;
|
||||||
sendPacket(14, false);
|
sendPacket(14, false);
|
||||||
|
mRqstGetRx = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initPacket(const uint64_t *ivId, uint8_t mid, uint8_t pid) {
|
void initPacket(const uint64_t *ivId, uint8_t mid, uint8_t pid) {
|
||||||
|
@ -183,7 +188,8 @@ class CmtRadio {
|
||||||
uint32_t mDtuSn;
|
uint32_t mDtuSn;
|
||||||
uint8_t mTxBuf[27];
|
uint8_t mTxBuf[27];
|
||||||
bool mSerialDebug;
|
bool mSerialDebug;
|
||||||
volatile uint8_t mIrqRcvd;
|
bool mIrqRcvd;
|
||||||
|
bool mRqstGetRx;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*__HMS_RADIO_H__*/
|
#endif /*__HMS_RADIO_H__*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue