mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-16 10:02:05 +00:00
autoformat per formatting rules
This commit is contained in:
parent
8eb3045451
commit
176532f55f
@ -6,17 +6,8 @@
|
|||||||
#include <RHGenericDriver.h>
|
#include <RHGenericDriver.h>
|
||||||
|
|
||||||
RHGenericDriver::RHGenericDriver()
|
RHGenericDriver::RHGenericDriver()
|
||||||
:
|
: _mode(RHModeInitialising), _thisAddress(RH_BROADCAST_ADDRESS), _txHeaderTo(RH_BROADCAST_ADDRESS),
|
||||||
_mode(RHModeInitialising),
|
_txHeaderFrom(RH_BROADCAST_ADDRESS), _txHeaderId(0), _txHeaderFlags(0), _rxBad(0), _rxGood(0), _txGood(0), _cad_timeout(0)
|
||||||
_thisAddress(RH_BROADCAST_ADDRESS),
|
|
||||||
_txHeaderTo(RH_BROADCAST_ADDRESS),
|
|
||||||
_txHeaderFrom(RH_BROADCAST_ADDRESS),
|
|
||||||
_txHeaderId(0),
|
|
||||||
_txHeaderFlags(0),
|
|
||||||
_rxBad(0),
|
|
||||||
_rxGood(0),
|
|
||||||
_txGood(0),
|
|
||||||
_cad_timeout(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,10 +29,8 @@ void RHGenericDriver::waitAvailable()
|
|||||||
bool RHGenericDriver::waitAvailableTimeout(uint16_t timeout)
|
bool RHGenericDriver::waitAvailableTimeout(uint16_t timeout)
|
||||||
{
|
{
|
||||||
unsigned long starttime = millis();
|
unsigned long starttime = millis();
|
||||||
while ((millis() - starttime) < timeout)
|
while ((millis() - starttime) < timeout) {
|
||||||
{
|
if (available()) {
|
||||||
if (available())
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
YIELD;
|
YIELD;
|
||||||
@ -59,8 +48,7 @@ bool RHGenericDriver::waitPacketSent()
|
|||||||
bool RHGenericDriver::waitPacketSent(uint16_t timeout)
|
bool RHGenericDriver::waitPacketSent(uint16_t timeout)
|
||||||
{
|
{
|
||||||
unsigned long starttime = millis();
|
unsigned long starttime = millis();
|
||||||
while ((millis() - starttime) < timeout)
|
while ((millis() - starttime) < timeout) {
|
||||||
{
|
|
||||||
if (_mode != RHModeTx) // Any previous transmit finished?
|
if (_mode != RHModeTx) // Any previous transmit finished?
|
||||||
return true;
|
return true;
|
||||||
YIELD;
|
YIELD;
|
||||||
@ -80,8 +68,7 @@ bool RHGenericDriver::waitCAD()
|
|||||||
// 100 - 1000 ms
|
// 100 - 1000 ms
|
||||||
// 10 sec timeout
|
// 10 sec timeout
|
||||||
unsigned long t = millis();
|
unsigned long t = millis();
|
||||||
while (isChannelActive())
|
while (isChannelActive()) {
|
||||||
{
|
|
||||||
if (millis() - t > _cad_timeout)
|
if (millis() - t > _cad_timeout)
|
||||||
return false;
|
return false;
|
||||||
#if (RH_PLATFORM == RH_PLATFORM_STM32) // stdlib on STMF103 gets confused if random is redefined
|
#if (RH_PLATFORM == RH_PLATFORM_STM32) // stdlib on STMF103 gets confused if random is redefined
|
||||||
@ -172,17 +159,15 @@ bool RHGenericDriver::sleep()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Diagnostic help
|
// Diagnostic help
|
||||||
void RHGenericDriver::printBuffer(const char* prompt, const uint8_t* buf, uint8_t len)
|
void RHGenericDriver::printBuffer(const char *prompt, const uint8_t *buf, uint8_t len)
|
||||||
{
|
{
|
||||||
#ifdef RH_HAVE_SERIAL
|
#ifdef RH_HAVE_SERIAL
|
||||||
Serial.println(prompt);
|
Serial.println(prompt);
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++) {
|
||||||
{
|
|
||||||
if (i % 16 == 15)
|
if (i % 16 == 15)
|
||||||
Serial.println(buf[i], HEX);
|
Serial.println(buf[i], HEX);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Serial.print(buf[i], HEX);
|
Serial.print(buf[i], HEX);
|
||||||
Serial.print(' ');
|
Serial.print(' ');
|
||||||
}
|
}
|
||||||
@ -216,6 +201,7 @@ void RHGenericDriver::setCADTimeout(unsigned long cad_timeout)
|
|||||||
// get linking complaints from the default code generated for pure virtual functions
|
// get linking complaints from the default code generated for pure virtual functions
|
||||||
extern "C" void __cxa_pure_virtual()
|
extern "C" void __cxa_pure_virtual()
|
||||||
{
|
{
|
||||||
while (1);
|
while (1)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user