1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-07-29 02:02:00 +03:00

Moved to actions, no doxygen

This commit is contained in:
dherrada
2020-06-25 09:56:46 -04:00
parent 3693eb8800
commit 148cfb3591
10 changed files with 414 additions and 359 deletions

View File

@ -1,20 +1,27 @@
#include "Adafruit_FONA.h"
#include <Adafruit_SleepyDog.h>
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
#define halt(s) { Serial.println(F( s )); while(1); }
#define halt(s) \
{ \
Serial.println(F(s)); \
while (1) \
; \
}
extern Adafruit_FONA fona;
extern SoftwareSerial fonaSS;
boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password) {
boolean FONAconnect(const __FlashStringHelper *apn,
const __FlashStringHelper *username,
const __FlashStringHelper *password) {
Watchdog.reset();
Serial.println(F("Initializing FONA....(May take 3 seconds)"));
fonaSS.begin(4800); // if you're using software serial
if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
if (!fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
Serial.println(F("Couldn't find FONA"));
return false;
}
@ -23,25 +30,25 @@ boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *u
Watchdog.reset();
Serial.println(F("Checking for network..."));
while (fona.getNetworkStatus() != 1) {
delay(500);
delay(500);
}
Watchdog.reset();
delay(5000); // wait a few seconds to stabilize connection
delay(5000); // wait a few seconds to stabilize connection
Watchdog.reset();
fona.setGPRSNetworkSettings(apn, username, password);
Serial.println(F("Disabling GPRS"));
fona.enableGPRS(false);
Watchdog.reset();
delay(5000); // wait a few seconds to stabilize connection
delay(5000); // wait a few seconds to stabilize connection
Watchdog.reset();
Serial.println(F("Enabling GPRS"));
if (!fona.enableGPRS(true)) {
Serial.println(F("Failed to turn GPRS on"));
Serial.println(F("Failed to turn GPRS on"));
return false;
}
Watchdog.reset();