if(_statusled_timer < now) { if(lastframe_time+5000 < now) { // no gps communication _statusled_state = !_statusled_state; digitalWrite(13, _statusled_state ? HIGH : LOW); // set the LED off _statusled_timer = now + 1000; return; } if(_statusled_blinks==0) { if(i2c_dataset.status.gps3dfix == 1) _statusled_blinks=3; else if(i2c_dataset.status.gps2dfix == 1) _statusled_blinks=2; else _statusled_blinks=1; } if(_statusled_state) { _statusled_blinks--; _statusled_state = false; _statusled_timer = now + ((_statusled_blinks>0) ? BLINK_INTERVAL : 1000); digitalWrite(13, LOW); // set the LED off } else { _statusled_state = true; _statusled_timer = now + BLINK_INTERVAL; digitalWrite(13, HIGH); // set the LED on } } }