Skip to content

Commit 470c70a

Browse files
committed
Add print helper functions. Print to both Serial+Serial1 as needed.
1 parent bdae0b3 commit 470c70a

File tree

9 files changed

+344
-261
lines changed

9 files changed

+344
-261
lines changed

Firmware/LoRaSerial_Firmware/Begin.ino

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ void beginLoRa()
112112
int state = radio.begin(centerFreq); //Doesn't matter what freq we start at
113113
if (state != RADIOLIB_ERR_NONE)
114114
{
115-
Serial.print(F("Radio init failed with code: "));
116-
Serial.println(state);
115+
systemPrint(F("Radio init failed with code: "));
116+
systemPrintln(state);
117117
while (1)
118118
{
119119
petWDT();
@@ -125,8 +125,8 @@ void beginLoRa()
125125
randomSeed(radioSeed);
126126
if (settings.debug == true)
127127
{
128-
Serial.print("RadioSeed: ");
129-
Serial.println(radioSeed);
128+
systemPrint("RadioSeed: ");
129+
systemPrintln(radioSeed);
130130
}
131131

132132
generateHopTable(); //Generate frequency table based on randomByte
@@ -160,6 +160,23 @@ void beginWDT()
160160
#endif
161161
}
162162

163+
void beginSerial(uint16_t serialSpeed)
164+
{
165+
Serial.begin(settings.serialSpeed);
166+
#if defined(ARDUINO_ARCH_SAMD)
167+
Serial1.begin(settings.serialSpeed);
168+
#endif
169+
170+
#if defined(ENABLE_DEVELOPER)
171+
//Wait for serial to come online for debug printing
172+
#if defined(ARDUINO_ARCH_ESP32)
173+
delay(500);
174+
#elif defined(ARDUINO_ARCH_SAMD)
175+
while (!Serial);
176+
#endif
177+
#endif
178+
}
179+
163180
void petWDT()
164181
{
165182
//Petting the dog takes a really long time on the SAMD21, 4-5ms to complete

0 commit comments

Comments
 (0)