mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 18:09:04 +00:00
Fix nrf52 USB (don't call delay() in loop() if connected via usb)
This commit is contained in:
parent
a42bb80cf4
commit
28b7bd347a
@ -435,7 +435,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define RF95_NSS RADIOLIB_NC // the ch341f spi controller does CS for us
|
#define RF95_NSS RADIOLIB_NC // the ch341f spi controller does CS for us
|
||||||
|
|
||||||
#define LORA_DIO0 26 // a No connect on the SX1262 module
|
#define LORA_DIO0 26 // a No connect on the SX1262 module
|
||||||
#define LORA_RESET RADIOLIB_NC
|
#define LORA_RESET 14
|
||||||
#define LORA_DIO1 33 // SX1262 IRQ, called DIO0 on pinelora schematic, pin 7 on ch341f "ack" - FIXME, enable hwints in linux
|
#define LORA_DIO1 33 // SX1262 IRQ, called DIO0 on pinelora schematic, pin 7 on ch341f "ack" - FIXME, enable hwints in linux
|
||||||
#define LORA_DIO2 32 // SX1262 BUSY, actually connected to "DIO5" on pinelora schematic, pin 8 on ch341f "slct"
|
#define LORA_DIO2 32 // SX1262 BUSY, actually connected to "DIO5" on pinelora schematic, pin 8 on ch341f "slct"
|
||||||
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
|
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
|
||||||
|
@ -299,6 +299,13 @@ uint32_t ButtonThread::longPressTime = 0;
|
|||||||
|
|
||||||
RadioInterface *rIf = NULL;
|
RadioInterface *rIf = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some platforms (nrf52) might provide an alterate version that supresses calling delay from sleep.
|
||||||
|
*/
|
||||||
|
__attribute__ ((weak, noinline)) bool loopCanSleep() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
concurrency::hasBeenSetup = true;
|
concurrency::hasBeenSetup = true;
|
||||||
@ -640,7 +647,7 @@ void loop()
|
|||||||
mainController.nextThread->tillRun(millis())); */
|
mainController.nextThread->tillRun(millis())); */
|
||||||
|
|
||||||
// We want to sleep as long as possible here - because it saves power
|
// We want to sleep as long as possible here - because it saves power
|
||||||
if (!runASAP)
|
if (!runASAP && loopCanSleep())
|
||||||
mainDelay.delay(delayMsec);
|
mainDelay.delay(delayMsec);
|
||||||
// if (didWake) DEBUG_MSG("wake!\n");
|
// if (didWake) DEBUG_MSG("wake!\n");
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@ static inline void debugger_break(void)
|
|||||||
"mov pc, lr\n\t");
|
"mov pc, lr\n\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool loopCanSleep() {
|
||||||
|
return !tud_cdc_connected();
|
||||||
|
}
|
||||||
|
|
||||||
// handle standard gcc assert failures
|
// handle standard gcc assert failures
|
||||||
void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *failedexpr)
|
void __attribute__((noreturn)) __assert_func(const char *file, int line, const char *func, const char *failedexpr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user