From ab7ed60b2cad2c713383a5597a7aaed4de664c91 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 29 Jun 2024 18:31:13 +0200 Subject: [PATCH] [CC1101] Added delay to halting while loops --- .../CC1101_Receive_Address.ino | 6 +++--- .../CC1101_Receive_Blocking.ino | 2 +- .../CC1101_Receive_Interrupt.ino | 4 ++-- .../CC1101/CC1101_Settings/CC1101_Settings.ino | 18 +++++++++--------- .../CC1101_Transmit_Address.ino | 6 +++--- .../CC1101_Transmit_Blocking.ino | 2 +- .../CC1101_Transmit_Interrupt.ino | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/CC1101/CC1101_Receive_Address/CC1101_Receive_Address.ino b/examples/CC1101/CC1101_Receive_Address/CC1101_Receive_Address.ino index 2f912f08..9eeaca9b 100644 --- a/examples/CC1101/CC1101_Receive_Address/CC1101_Receive_Address.ino +++ b/examples/CC1101/CC1101_Receive_Address/CC1101_Receive_Address.ino @@ -39,7 +39,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // set node address @@ -56,7 +56,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // address filtering can also be disabled @@ -70,7 +70,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while(true); + while (true) { delay(10); } } */ } diff --git a/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino b/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino index 32dbe6bf..11edd45c 100644 --- a/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino +++ b/examples/CC1101/CC1101_Receive_Blocking/CC1101_Receive_Blocking.ino @@ -46,7 +46,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } } diff --git a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino index 4f3e69d8..6b585fe5 100644 --- a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino +++ b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino @@ -44,7 +44,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // set the function that will be called @@ -59,7 +59,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // if needed, 'listen' mode can be disabled by calling diff --git a/examples/CC1101/CC1101_Settings/CC1101_Settings.ino b/examples/CC1101/CC1101_Settings/CC1101_Settings.ino index 680c60d1..8ba03b13 100644 --- a/examples/CC1101/CC1101_Settings/CC1101_Settings.ino +++ b/examples/CC1101/CC1101_Settings/CC1101_Settings.ino @@ -50,7 +50,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // initialize CC1101 with non-default settings @@ -67,7 +67,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // you can also change the settings at runtime @@ -76,42 +76,42 @@ void setup() { // set carrier frequency to 433.5 MHz if (radio1.setFrequency(433.5) == RADIOLIB_ERR_INVALID_FREQUENCY) { Serial.println(F("[CC1101] Selected frequency is invalid for this module!")); - while (true); + while (true) { delay(10); } } // set bit rate to 100.0 kbps state = radio1.setBitRate(100.0); if (state == RADIOLIB_ERR_INVALID_BIT_RATE) { Serial.println(F("[CC1101] Selected bit rate is invalid for this module!")); - while (true); + while (true) { delay(10); } } else if (state == RADIOLIB_ERR_INVALID_BIT_RATE_BW_RATIO) { Serial.println(F("[CC1101] Selected bit rate to bandwidth ratio is invalid!")); Serial.println(F("[CC1101] Increase receiver bandwidth to set this bit rate.")); - while (true); + while (true) { delay(10); } } // set receiver bandwidth to 250.0 kHz if (radio1.setRxBandwidth(250.0) == RADIOLIB_ERR_INVALID_RX_BANDWIDTH) { Serial.println(F("[CC1101] Selected receiver bandwidth is invalid for this module!")); - while (true); + while (true) { delay(10); } } // set allowed frequency deviation to 10.0 kHz if (radio1.setFrequencyDeviation(10.0) == RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION) { Serial.println(F("[CC1101] Selected frequency deviation is invalid for this module!")); - while (true); + while (true) { delay(10); } } // set output power to 5 dBm if (radio1.setOutputPower(5) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) { Serial.println(F("[CC1101] Selected output power is invalid for this module!")); - while (true); + while (true) { delay(10); } } // 2 bytes can be set as sync word if (radio1.setSyncWord(0x01, 0x23) == RADIOLIB_ERR_INVALID_SYNC_WORD) { Serial.println(F("[CC1101] Selected sync word is invalid for this module!")); - while (true); + while (true) { delay(10); } } } diff --git a/examples/CC1101/CC1101_Transmit_Address/CC1101_Transmit_Address.ino b/examples/CC1101/CC1101_Transmit_Address/CC1101_Transmit_Address.ino index 4aa219d3..ecdec620 100644 --- a/examples/CC1101/CC1101_Transmit_Address/CC1101_Transmit_Address.ino +++ b/examples/CC1101/CC1101_Transmit_Address/CC1101_Transmit_Address.ino @@ -39,7 +39,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // set node address @@ -56,7 +56,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // address filtering can also be disabled @@ -70,7 +70,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while(true); + while (true) { delay(10); } } */ } diff --git a/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino b/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino index fc62ec63..d42dbed6 100644 --- a/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino +++ b/examples/CC1101/CC1101_Transmit_Blocking/CC1101_Transmit_Blocking.ino @@ -43,7 +43,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } } diff --git a/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino b/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino index 455d83dd..4e4e2a1f 100644 --- a/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino +++ b/examples/CC1101/CC1101_Transmit_Interrupt/CC1101_Transmit_Interrupt.ino @@ -43,7 +43,7 @@ void setup() { } else { Serial.print(F("failed, code ")); Serial.println(state); - while (true); + while (true) { delay(10); } } // set the function that will be called