diff --git a/src/neutrino.cpp b/src/neutrino.cpp index dcdd119fd..f66da4a8d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3746,25 +3746,28 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) struct tm *tmtime = localtime(&mtime); time_t fp_timer = 0; - if(timer_minutes) - fp_timer = (timer_minutes - mtime)/60; -printf("now: %ld, timer %ld, FP timer %ld\n", mtime/60, timer_minutes/60, fp_timer);fflush(stdout); + if(timer_minutes) { + fp_timer = timer_minutes - mtime/60; + if(fp_timer < 1) + fp_timer = 1; + } + printf("now: %ld, timer %ld, FP timer %ldmin\n", mtime/60, timer_minutes, fp_timer);fflush(stdout); int leds = 0x40; switch(g_settings.led_deep_mode){ case 0: - leds = 0x0;//off leds - break; + leds = 0x0;//off leds + break; case 1: - leds = 0x60;//on led1 & 2 - break; + leds = 0x60;//on led1 & 2 + break; case 2: - leds = 0x20;//led1 on , 2 off - break; + leds = 0x20;//led1 on , 2 off + break; case 3: - leds = 0x40;//led2 off, 2 on - break; + leds = 0x40;//led2 off, 2 on + break; default: - break; + break; } standby.brightness = g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 8fcfe4224..ef57927a1 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -62,7 +63,19 @@ void CTimerManager::Init(void) m_saveEvents = false; m_isTimeSet = false; wakeup = 0; -printf("[timerd] wakeup from standby: %s\n", wakeup ? "yes" : "no"); + + int fd = open("/dev/display", O_RDONLY); + + if (fd < 0) { + perror("/dev/display"); + } else { + wakeup_data_t wk; + memset(&wk, 0, sizeof(wk)); + int ret = ioctl(fd, IOC_VFD_GET_WAKEUP, &wk); + if(ret >= 0) + wakeup = ((wk.source == WAKEUP_SOURCE_TIMER) /* || (wk.source == WAKEUP_SOURCE_PWLOST)*/); + } + printf("[timerd] wakeup from standby: %s\n", wakeup ? "yes" : "no"); if(wakeup) creat("/tmp/.wakeup", 0); @@ -664,7 +677,7 @@ void CTimerManager::saveEventsToConfig() //------------------------------------------------------------ bool CTimerManager::shutdown() { -timerd_debug = 1; + timerd_debug = 1; //FIXME time_t nextAnnounceTime=0; bool status=false; dprintf("stopping timermanager thread ...\n"); @@ -690,10 +703,10 @@ timerd_debug = 1; for(;pos != events.end();pos++) { CTimerEvent *event = pos->second; -dprintf("shutdown: timer type %d state %d announceTime: %ld\n", event->eventType, event->eventState, event->announceTime); + dprintf("shutdown: timer type %d state %d announceTime: %ld\n", event->eventType, event->eventState, event->announceTime); if((event->eventType == CTimerd::TIMER_RECORD || event->eventType == CTimerd::TIMER_ZAPTO ) && - event->eventState == CTimerd::TIMERSTATE_SCHEDULED) + event->eventState < CTimerd::TIMERSTATE_ISRUNNING) { // Wir wachen nur für Records und Zaptos wieder auf if(event->announceTime < nextAnnounceTime || nextAnnounceTime==0) @@ -705,9 +718,9 @@ dprintf("shutdown: timer type %d state %d announceTime: %ld\n", event->eventType } timer_minutes = 0; - if(nextAnnounceTime!=0) + if(nextAnnounceTime != 0) { - timer_minutes = nextAnnounceTime-3*60; + timer_minutes = (nextAnnounceTime - 3*60)/60; } dprintf("shutdown: timeset: %d timer_minutes %ld\n", timeset, timer_minutes);