QState PSConsole::MainMenu(PSConsole *me, QEvent const *e) { switch (e->sig) { case Q_ENTRY_SIG: PrintMenuTitles(MAIN_MENU_COUNT, menuMain); return Q_HANDLED(); case MENU_SELECT_SIG: { switch (((MenuSelectEvt*)e)->item_index) { case 0: PrintMenuTitles(MAIN_MENU_COUNT, menuMain); return Q_HANDLED(); case 1: Ps.SetDevicePropValue(PS_DPC_CaptureTransferMode, (uint16_t)0x0D); Ps.Capture(); return Q_HANDLED(); case 2: ShowParams(); PrintMenuTitles(MAIN_MENU_COUNT, menuMain); return Q_HANDLED(); case 3: return Q_TRAN(&PSConsole::ChangeSettingsMenu); case 4: Ps.Operation(PS_OC_ViewfinderOn); return Q_HANDLED(); case 5: Ps.Operation(PS_OC_ViewfinderOff); return Q_HANDLED(); } } } return Q_SUPER(&PSConsole::Active); }
QState EOSConsole::MainMenu(EOSConsole *me, QEvt const *e) { switch (e->sig) { case Q_ENTRY_SIG: PrintMenuTitles(3, menuMain); return Q_HANDLED(); case MENU_SELECT_SIG: { switch (((MenuSelectEvt*)e)->item_index) { case 0: PrintMenuTitles(3, menuMain); return Q_HANDLED(); case 1: Eos.Capture(); return Q_HANDLED(); case 2: ShowParams(); PrintMenuTitles(3, menuMain); return Q_HANDLED(); case 3: return Q_TRAN(&EOSConsole::ChangeSettingsMenu); } } } return Q_SUPER(&EOSConsole::Active); }
void ProcessInput(LIVECONFIG *config, char const *buffer) { int InVal; char const *next = FindWordEnd(buffer); uint8_t CmdID = FindCommand(g_commands, buffer, next - buffer); uint8_t ShiftID; buffer = SkipWhitespaces(next); next = FindWordEnd(buffer); switch(CmdID) { case 0: //show ShowParams(config); break; case 1: //save #if defined(USE_EEPROM) I2cEEPROM_Write(&g_eeprom, EESTART, config, sizeof(*config)); #endif break; case 2: //debug mask if((InVal = GetIntParam(buffer, next - buffer, 1, 0)) >= 0) g_config.debug = InVal; else g_config.debug = g_config.debug ? 0 : -1; break; case 3: //mccnt if((InVal = GetIntParam(buffer, next - buffer, 1, 0)) >= 0) config->mccount = InVal; break; case 4: //thdiv if((InVal = GetIntParam(buffer, next - buffer, 1, 0)) >= 0) config->thdiv = InVal; break; case 5: //tlim if((InVal = GetIntParam(buffer, next - buffer, 1, 0)) >= 0) config->tlimit = InVal; break; case 6: //shift ShiftID = FindCommand(g_shifts, buffer, next - buffer); buffer = SkipWhitespaces(next); next = FindWordEnd(buffer); InVal = GetIntParam(buffer, next - buffer, 1, 0); if(InVal != INT_MIN) { if(ShiftID < 4) config->shifts[g_shiftDisps[ShiftID]] = InVal; else if(ShiftID == 4) config->sumshift = InVal; } break; case 7: // reset g_config = g_config_default; break; case 8: //led channel val0 val1 val2 val3 val4 val5 val6 val7 #if defined(USE_LEDBAR) { uint8_t channel; int i; InVal = GetIntParam(buffer, next - buffer, 1, 0); if(InVal != INT_MIN) { channel = InVal; buffer = SkipWhitespaces(next); next = FindWordEnd(buffer); for(i=0; i<8; ++i) { InVal = GetIntParam(buffer, next - buffer, 1, 0); if(InVal != INT_MIN) { g_config.ledbarvalues[channel][i] = InVal; buffer = SkipWhitespaces(next); next = FindWordEnd(buffer); } else break; } } } #endif break; default: #if defined(USE_SERIAL) { const CmdDesc *cmd = g_commands; UsartSend("\r\nUsage: ", 9, 1); while(cmd->len) { UsartSend(cmd->cmd, cmd->len, 1); UsartSend(" ", 1, 1); ++cmd; } UsartSend("\r\n",2, 1); } #endif break; } }
void key_GetParamsAll(void) { if (bKey == bKEY_ENTER) { if (enKeyboard == KBD_ENTER) { enKeyboard = KBD_INPUT1; Param(); switch (wProgram) { case bGET_PARAMS_CURR: ShowHi(szParamCurr); break; case bGET_PARAMS_BUFF: ShowHi(szParamBuff); break; case bGET_PARAMS_FULL: ShowHi(szParamFull); break; } } else if (enKeyboard == KBD_INPUT1) { enKeyboard = KBD_POSTENTER; Clear(); ibVal = 0; iwTim = 0; iwPrm = 0; ShowParams(); } else if (enKeyboard == KBD_POSTINPUT1) { if ((iwPrm = GetIntLo(10,12) - 1) < wPARAMS) { enKeyboard = KBD_POSTENTER; Clear(); ShowParams(); } else Beep(); } else if (enKeyboard == KBD_POSTENTER) { if (++iwPrm >= wPARAMS) iwPrm = 0; ibVal = 0; iwTim = 0; ShowParams(); } else Beep(); } else if (bKey == bKEY_POINT) { if (enKeyboard == KBD_POSTENTER) { if (iwPrm > 0) iwPrm--; else iwPrm = wPARAMS - 1; ibVal = 0; iwTim = 0; ShowParams(); } else Beep(); } else if (bKey == bKEY_MINUS) { if (++ibVal >= 3) ibVal = 0; if (++iwTim >= wTIMES) iwTim = 0; ShowParams(); } else if (bKey < 10) { if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1)) { enKeyboard = KBD_POSTINPUT1; ShiftLo(10,12); } else Beep(); } else Beep(); }