Remove old debug code and add waitOnBusy timeout to SX1262

This commit is contained in:
jacob.eva 2024-02-10 11:56:58 +00:00
parent b96559d799
commit a1793043b2
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E
2 changed files with 5 additions and 7 deletions

View File

@ -190,9 +190,13 @@ void sx126x::loraMode() {
}
void sx126x::waitOnBusy() {
unsigned long time = millis();
if (_busy != -1) {
while (digitalRead(_busy) == HIGH)
{
if (millis() >= (time + 100)) {
break;
}
// do nothing
}
}

View File

@ -204,9 +204,7 @@ void sx128x::waitOnBusy() {
if (_busy != -1) {
while (digitalRead(_busy) == HIGH)
{
if (millis() >= (time + 300)) {
pinMode(LED_BLUE, OUTPUT);
digitalWrite(LED_BLUE, HIGH);
if (millis() >= (time + 100)) {
break;
}
// do nothing
@ -458,7 +456,6 @@ uint8_t sx128x::modemStatus() {
// imitate the register status from the sx1276 / 78
uint8_t buf[2] = {0};
// debug
executeOpcodeRead(OP_GET_IRQ_STATUS_8X, buf, 2);
uint8_t clearbuf[2] = {0};
@ -468,18 +465,15 @@ uint8_t sx128x::modemStatus() {
if (buf[0] & IRQ_PREAMBLE_DET_MASK_8X != 0) {
byte = byte | 0x01 | 0x04;
// clear register after reading
//clearbuf[0] = IRQ_PREAMBLE_DET_MASK_8X;
clearbuf[0] = 0xFF;
}
if (buf[1] & IRQ_HEADER_DET_MASK_8X != 0) {
byte = byte | 0x02 | 0x04;
// clear register after reading
//clearbuf[1] = IRQ_HEADER_DET_MASK_8X;
clearbuf[1] = 0xFF;
}
// debug
executeOpcode(OP_CLEAR_IRQ_STATUS_8X, clearbuf, 2);
return byte;