Skip to content

Add adjustStartupTimeout() functionality #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ isAsleep KEYWORD2
setPowerProfile KEYWORD2
adjustATTimeout KEYWORD2
adjustSendReceiveTimeout KEYWORD2
adjustStartupTimeout KEYWORD2
useMSSTMWorkaround KEYWORD2
getSystemTime KEYWORD2
getFirmwareVersion KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=IridiumSBDi2c
version=3.0.1
version=3.0.2
author=Mikal Hart and Paul Clark (PaulZC)
maintainer=SparkFun Electronics <sparkfun.com>
sentence=This library supports satellite data transmissions from anywhere on earth using the RockBLOCK family of Iridium 9602 and 9603 modems.
Expand Down
8 changes: 7 additions & 1 deletion src/IridiumSBD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ void IridiumSBD::adjustSendReceiveTimeout(int seconds)
this->sendReceiveTimeout = seconds;
}

// Tweak ISBD startup timeout
void IridiumSBD::adjustStartupTimeout(int seconds)
{
this->startupTimeout = seconds;
}

void IridiumSBD::useMSSTMWorkaround(bool useWorkAround) // true to use workaround from Iridium Alert 5/7
{
this->msstmWorkaroundRequested = useWorkAround;
Expand Down Expand Up @@ -539,7 +545,7 @@ int IridiumSBD::internalBegin()
return ISBD_CANCELLED;

// Turn on modem and wait for a response from "AT" command to begin
for (unsigned long start = millis(); !modemAlive && millis() - start < 1000UL * ISBD_STARTUP_MAX_TIME;)
for (unsigned long start = millis(); !modemAlive && millis() - start < 1000UL * this->startupTimeout;)
{
send(F("AT\r"));
modemAlive = waitForATResponse();
Expand Down
4 changes: 4 additions & 0 deletions src/IridiumSBD.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class IridiumSBD
void setPowerProfile(POWERPROFILE profile); // 0 = direct connect (default), 1 = USB
void adjustATTimeout(int seconds); // default value = 20 seconds
void adjustSendReceiveTimeout(int seconds); // default value = 300 seconds
void adjustStartupTimeout(int seconds); // default value = 240 seconds
void useMSSTMWorkaround(bool useMSSTMWorkAround); // true to use workaround from Iridium Alert 5/7/13
void enableRingAlerts(bool enable);

Expand All @@ -140,6 +141,7 @@ class IridiumSBD
sbdixInterval = ISBD_USB_SBDIX_INTERVAL;
atTimeout = ISBD_DEFAULT_AT_TIMEOUT;
sendReceiveTimeout = ISBD_DEFAULT_SENDRECEIVE_TIME;
startupTimeout = ISBD_STARTUP_MAX_TIME;
remainingMessages = -1;
asleep = true;
reentrant = false;
Expand Down Expand Up @@ -168,6 +170,7 @@ class IridiumSBD
sbdixInterval = ISBD_USB_SBDIX_INTERVAL;
atTimeout = ISBD_DEFAULT_AT_TIMEOUT;
sendReceiveTimeout = ISBD_DEFAULT_SENDRECEIVE_TIME;
startupTimeout = ISBD_STARTUP_MAX_TIME;
remainingMessages = -1;
asleep = true;
reentrant = false;
Expand Down Expand Up @@ -206,6 +209,7 @@ class IridiumSBD
int sbdixInterval;
int atTimeout;
int sendReceiveTimeout;
int startupTimeout;
unsigned long lastCheck = 0; // The time in millis when the I2C bus was last checked (limits I2C traffic)
const uint8_t I2C_POLLING_WAIT_MS = 5; //Limit checking of new characters to every 5 ms (roughly 10 chars at 19200 baud)

Expand Down