@@ -229,70 +229,6 @@ static void buttonBluetooth(const DataSet *dataSet, uint16_t measureIndex) {
229229
230230static uint8_t shutdownState = 0 ;
231231
232- #ifdef OBSPRO
233- // Power-management keep alive timer
234- // This function is called every 100 ms
235- static unsigned long timeOfLastPowerKeepAlive = 0 ;
236- static uint8_t buttonPressedCounter = 0 ;
237- static void powerKeepAliveTimerISR ()
238- {
239- // Send "keep alive" trigger to power management module
240- // This is done by toggling the pin every 300 ms or more
241- if (shutdownState == 0 )
242- {
243- if (!digitalRead (IP5306_BUTTON) && millis () - timeOfLastPowerKeepAlive > POWER_KEEP_ALIVE_INTERVAL_MS)
244- {
245- timeOfLastPowerKeepAlive = millis ();
246- digitalWrite (IP5306_BUTTON, HIGH);
247- }
248- else if (digitalRead (IP5306_BUTTON) && millis () - timeOfLastPowerKeepAlive > 300 )
249- {
250- timeOfLastPowerKeepAlive = millis ();
251- digitalWrite (IP5306_BUTTON, LOW);
252- }
253- }
254-
255- // Soft power-off OBSPro when button is pressed for more than 2 seconds
256- if (button.read ())
257- {
258- if (buttonPressedCounter < 255 )
259- buttonPressedCounter++;
260- }
261- else
262- buttonPressedCounter = 0 ;
263-
264- if (shutdownState == 0 && buttonPressedCounter >= 50 ) {
265- shutdownState = 1 ;
266- }
267- switch (shutdownState)
268- {
269- case 1 :
270- digitalWrite (IP5306_BUTTON, LOW);
271- break ;
272- case 4 :
273- digitalWrite (IP5306_BUTTON, HIGH);
274- break ;
275- case 7 :
276- digitalWrite (IP5306_BUTTON, LOW);
277- break ;
278- case 10 :
279- digitalWrite (IP5306_BUTTON, HIGH);
280- break ;
281- case 13 :
282- digitalWrite (IP5306_BUTTON, LOW);
283- noInterrupts ();
284- while (1 )
285- NOP ();
286- break ;
287- default :
288- break ;
289- }
290- if (shutdownState != 0 && shutdownState < 13 )
291- shutdownState++;
292- }
293-
294- #endif
295-
296232void setup () {
297233 Serial.begin (115200 );
298234 log_i (" openbikesensor.org - OBS/%s" , OBSVersion);
@@ -310,14 +246,6 @@ void setup() {
310246 digitalWrite (GPS_POWER_PIN,HIGH);
311247 #endif
312248
313- #ifdef OBSPRO
314- // Setup power management timer to trigger every 100ms (clock is 80 MHz)
315- timer0_powermanagement_cfg = timerBegin (0 , 1000 , true );
316- timerAttachInterrupt (timer0_powermanagement_cfg, &powerKeepAliveTimerISR, true );
317- timerAlarmWrite (timer0_powermanagement_cfg, 8000 , true );
318- timerAlarmEnable (timer0_powermanagement_cfg);
319- #endif
320-
321249 // ##############################################################
322250 // Setup display
323251 // ##############################################################
0 commit comments