static void ChangeModeHandler(unsigned char Option) { unsigned char Mode = Option & MODE_MASK; tMessage Msg; SetupMessageAndAllocateBuffer(&Msg, ModeChangeIndMsg, (CurrentIdleScreen() << 4) | Mode); Msg.pBuffer[0] = eScUpdateComplete; Msg.Length = 1; RouteMsg(&Msg); PrintStringAndHexByte("- ChgModInd:", Msg.Options); if (Option & MSG_OPT_CHGMOD_IND) return; // ask for current idle page only if (Mode == MUSIC_MODE) SendMessage(&Msg, UpdConnParamMsg, ShortInterval); if (Mode != IDLE_MODE) { PageType = PAGE_TYPE_IDLE; if (ModeTimerId == UNASSIGNED) ModeTimerId = AllocateOneSecondTimer(); SetupOneSecondTimer(ModeTimerId, ModeTimeout[Mode], NO_REPEAT, DISPLAY_QINDEX, ModeTimeoutMsg, Mode); StartOneSecondTimer(ModeTimerId); if (Option & MSG_OPT_UPD_INTERNAL) SendMessage(&Msg, UpdateDisplayMsg, Option); } else { StopOneSecondTimer(ModeTimerId); IdleUpdateHandler(); } CurrentMode = Mode; }
void ChangeMode(unsigned char Option) { // PrintF("- ChgModInd:0x%02x", Option); // PrintF(" PgTp %d Pg: %d", PageType, CurrentPage[PageType]); unsigned char Mode = Option & MODE_MASK; tMessage Msg = {1, ModeChangeIndMsg, (CurrentIdleScreen() << 4) | Mode, NULL}; if (CreateMessage(&Msg)) { Msg.pBuffer[0] = (Option >> 4) ? Option >> 4 : eScUpdateComplete; RouteMsg(&Msg); }
static void ChangeModeHandler(unsigned char Option) { PrintF("- ChgModInd:0x%02x", Option); PrintF(" PgTp %d Pg: %d", PageType, CurrentPage[PageType]); unsigned char Mode = Option & MODE_MASK; tMessage Msg; SetupMessageWithBuffer(&Msg, ModeChangeIndMsg, (CurrentIdleScreen() << 4) | Mode); if (Msg.pBuffer != NULL) { Msg.pBuffer[0] = eScUpdateComplete; Msg.Length = 1; RouteMsg(&Msg); } if (Option & MSG_OPT_CHGMOD_IND) return; // ask for current idle page only // StopTimer(ModeTimer); if (Mode == MUSIC_MODE) SendMessage(&Msg, UpdConnParamMsg, ShortInterval); else if (CurrentMode == MUSIC_MODE) SendMessage(&Msg, UpdConnParamMsg, LongInterval); CurrentMode = Mode; if (Mode == IDLE_MODE) { #if COUNTDOWN_TIMER if (CurrentPage[PageType] == CountdownPage) SendMessage(&Msg, CountDownMsg, MSG_OPT_NONE); else #endif { // PageType = PAGE_TYPE_IDLE; IdleUpdateHandler(); } } else { SetTimer(ModeTimer, ModeTimeOut[Mode], TOUT_ONCE); if (Option & MSG_OPT_UPD_INTERNAL) SendMessage(&Msg, UpdateDisplayMsg, Option); } }