//-------------------------------------------------------------- void testApp::keyPressed(int key){ switch (key) { case OF_KEY_LEFT: mInterval--; mInterval = MAX(mInterval, 1); break; case OF_KEY_RIGHT: mInterval++; break; case 'f': ofToggleFullscreen(); break; case ' ': bDebugMode = !bDebugMode; break; case 'c': bCircleMode = !bCircleMode; break; case OF_KEY_BACKSPACE: case OF_KEY_DEL: switch (mFMode) { case STATIC: if (mFigures[0].size()) { sendSet(mFigures[0].back().getModeID(), mFigures[0].back().getID()); mFigures[0].pop_back(); } break; case FLORTING: if (mFigures[1].size()) { sendSet(mFigures[1].back().getModeID(), mFigures[1].back().getID()); mFigures[1].pop_back(); } break; case AROUND: if (mFigures[2].size()) { sendSet(mFigures[2].back().getModeID(), mFigures[2].back().getID()); mFigures[2].pop_back(); } break; } break; // set mode case '1':mFMode = STATIC;break; case '2':mFMode = FLORTING;break; case '3':mFMode = AROUND;break; } }
void OpenDCCCtrlDlg::writeAll() { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "write all" ); int bps = m_Baudrate->GetSelection(); TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "bps is=%d, new=%d", m_soValue[so_bps], bps ); if( m_soValue[so_bps] != bps ) { /* * Attention: * OpenDCC is always expecting XpressNet (Lenz) * protocol baudrate values for write no matter * which protocol is selected for communication. */ /* lenz 0: 9600 Baud 1: 19200 Baud (default) 2: 38400 Baud 3: 57600 Baud 4: 115200 Baud 5: 2400 Baud 6: 4800 Baud p50x 0: 2400 Baud 1: 4800 Baud 2: 9600 Baud 3: 19200 Baud 4: 38400 Baud 5: 57600 Baud 6: 115200 Baud */ /* The dialog is using p50x values, so convert p50x to lenz */ switch( bps ) { case 0: bps = 5; break; case 1: bps = 6; break; case 2: bps = 0; break; case 3: bps = 1; break; case 4: bps = 2; break; case 5: bps = 3; break; case 6: bps = 4; break; } sendSet( so_bps, bps ); } if( m_soValue[so_dcc_format] != m_DecSpeedSteps->GetSelection() ) { sendSet( so_dcc_format, m_DecSpeedSteps->GetSelection() ); } int bidi = m_BiDiCutOut->IsChecked() ? 0x01:0x00; bidi |= m_BiDiIdNotify->IsChecked() ? 0x02:0x00; bidi |= m_BiDiAccQuery->IsChecked() ? 0x04:0x00; if( m_soValue[so_bidi] != bidi ) { sendSet( so_bidi, bidi ); } if( m_soValue[so_s88_timing] != m_S88Timing->GetValue() ) { sendSet( so_s88_timing, m_S88Timing->GetValue() ); } if( m_soValue[so_s88_bus1] != m_S88Bus1->GetValue() ) { sendSet( so_s88_bus1, m_S88Bus1->GetValue() ); } if( m_soValue[so_s88_bus2] != m_S88Bus2->GetValue() ) { sendSet( so_s88_bus2, m_S88Bus2->GetValue() ); } if( m_soValue[so_s88_bus3] != m_S88Bus3->GetValue() ) { sendSet( so_s88_bus3, m_S88Bus3->GetValue() ); } int mode = m_S88Active->IsChecked() ? 0x01:0x00; mode |= m_S88TurnoutSensors->IsChecked() ? 0x02:0x00; if( m_soValue[so_s88_mode] != mode ) { sendSet( so_s88_mode, mode ); } if( m_soValue[so_pt_resets] != m_PTResets->GetValue() ) { sendSet( so_pt_resets, m_PTResets->GetValue() ); } if( m_soValue[so_pt_commands] != m_PTCommands->GetValue() ) { sendSet( so_pt_commands, m_PTCommands->GetValue() ); } if( m_soValue[so_pt_pom] != m_PTPOMrepeat->GetValue() ) { sendSet( so_pt_pom, m_PTPOMrepeat->GetValue() ); } if( m_soValue[so_scd_main] != m_SCTimeMain->GetValue() ) { sendSet( so_scd_main, m_SCTimeMain->GetValue() ); } if( m_soValue[so_scd_pt] != m_SCTimePT->GetValue() ) { sendSet( so_scd_pt, m_SCTimePT->GetValue() ); } int swinvert = m_SwitchInvert->IsChecked() ? 0x01:0x00; if( m_soValue[so_sw_invert] != swinvert ) { sendSet( so_sw_invert, swinvert ); } if( m_soValue[so_sw_commands] != m_SwitchCommands->GetValue() ) { sendSet( so_sw_commands, m_SwitchCommands->GetValue() ); } if( m_soValue[so_sw_time] != m_SwitchTime->GetValue() ) { sendSet( so_sw_time, m_SwitchTime->GetValue() ); } if( m_soValue[so_sw_sensor_mode] != m_SwitchSensorMode->GetSelection() ) { sendSet( so_sw_sensor_mode, m_SwitchSensorMode->GetSelection() ); } if( m_soValue[so_sw_sensor_offset] != m_SwitchSensorOffset->GetValue() ) { sendSet( so_sw_sensor_offset, m_SwitchSensorOffset->GetValue() ); } if( m_soValue[so_serial_number] != m_SerialNumber->GetValue() ) { sendSet( so_serial_number, m_SerialNumber->GetValue() ); } if( m_soValue[so_xpn_feedback_mapping] != m_XpnFeedbackMapping->GetSelection() ) { sendSet( so_xpn_feedback_mapping, m_XpnFeedbackMapping->GetSelection() ); } if( m_soValue[so_xpn_sensors] != m_XpressNetSensors->GetValue() ) { sendSet( so_xpn_sensors, m_XpressNetSensors->GetValue() ); } m_ReadCVs->Enable(true); m_WriteCVs->Enable(true); }