You changed the logic and removed the startupPeriod test so in a failure condition it should never have restarted.
I did a partial test with the following code and it appears to work, forcing a restart if required after about 20 seconds.
I had to simulate the test with (gsmAccess.begin(PINNUMBER) == GSM_READY) by either if ( true ) or if (false) . You see the test statements in the code. I also put some debug statements to the serial console.
#include <Arduino.h> //v2
#include <avr/wdt.h> //v2
// definitions not visible in posted code. chang to your original . . .
byte readyPin = 4 ;
byte failPin = 5 ;
byte callPin = 6 ;
byte buttonPin = 7 ;
unsigned long currentMillis = 0 ;
unsigned long startupPeriod = 20000UL ; //20 seconds
unsigned long startMillis = 0 ;
void setup() {
Serial.begin( 115200 ) ;
Serial.println ("starting . . . ") ;
wdt_disable(); //v2
delay(2L * 1000L); //v2
wdt_enable(WDTO_2S); //v2
startMillis = millis();
// initialize the LED pins as an output
pinMode(readyPin, OUTPUT);
pinMode(failPin, OUTPUT);
pinMode(callPin, OUTPUT);
// initialize the pushbutton pin as an input
pinMode(buttonPin, INPUT);
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected == true) {
digitalWrite(failPin, HIGH);
// if (gsmAccess.begin(PINNUMBER) == GSM_READY) // original statement
// if ( true ) // simulate (gsmAccess.begin(PINNUMBER) == GSM_READY)
if ( false ) // simulate (gsmAccess.begin(PINNUMBER) != GSM_READY)
{ notConnected = false;
digitalWrite(failPin, LOW);
digitalWrite(readyPin, HIGH);
}
currentMillis = millis();
static unsigned long lastResetAtMs = 0 ;
if (currentMillis - startMillis >= startupPeriod) {
// digitalWrite(testPin, LOW);
}
else if ( currentMillis - lastResetAtMs > 1000 ) { // v2
wdt_reset(); // v2 - reset wdt every 1 second until startupPeriod expires
lastResetAtMs += 1000 ; // v2
Serial.println("waiting one more second") ;
}
}
wdt_disable(); //v2
}
void loop() {
Serial.println("now in loop") ;
delay( 1000 ) ;
}