wxStaticText *m_staticText28b = new wxStaticText(this, wxID_ANY, _("Wave File: "), wxDefaultPosition, wxDefaultSize, 0);
staticBoxSizer28a->Add(m_staticText28b, 0, wxALIGN_CENTER_VERTICAL, 5);
- m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,-1), 0);
+ m_txtCtrlVoiceKeyerWaveFile = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400,-1), 0);
m_txtCtrlVoiceKeyerWaveFile->SetToolTip(_("Wave file to play for Voice Keyer"));
staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerWaveFile, 0, 0, 5);
wxStaticText *m_staticText28c = new wxStaticText(this, wxID_ANY, _(" Rx Pause: "), wxDefaultPosition, wxDefaultSize, 0);
staticBoxSizer28a->Add(m_staticText28c, 0, wxALIGN_CENTER_VERTICAL , 5);
- m_txtCtrlVoiceKeyerRxPause = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+ m_txtCtrlVoiceKeyerRxPause = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0);
m_txtCtrlVoiceKeyerRxPause->SetToolTip(_("How long to wait in Rx mode before repeat"));
staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRxPause, 0, 0, 5);
wxStaticText *m_staticText28d = new wxStaticText(this, wxID_ANY, _(" Repeats: "), wxDefaultPosition, wxDefaultSize, 0);
staticBoxSizer28a->Add(m_staticText28d, 0, wxALIGN_CENTER_VERTICAL, 5);
- m_txtCtrlVoiceKeyerRepeats = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+ m_txtCtrlVoiceKeyerRepeats = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(40,-1), 0);
m_txtCtrlVoiceKeyerRepeats->SetToolTip(_("How long to wait in Rx mode before repeat"));
staticBoxSizer28a->Add(m_txtCtrlVoiceKeyerRepeats, 0, 0, 5);
//m_togTxID->Disable();
m_togBtnAnalog->Disable();
m_btnTogPTT->Disable();
+ m_togBtnVoiceKeyer->Disable();
//m_togBtnALC->Disable();
// squelch settings
frame->m_btnTogPTT->SetValue(true);
frame->togglePTT();
+ frame->VoiceKeyerProcessEvent(VK_SPACE_BAR);
return true; // absorb space so we don't toggle control with focus (e.g. Start)
+ space bar turns keyer off
+ 5 secs of valid sync turns it off
- [ ] complete state machine and builds OK
+ [X] complete state machine and builds OK
[ ] file select dialog
[ ] test all states
[ ] restore size
void MainFrame::OnTogBtnVoiceKeyerClick (wxCommandEvent& event)
{
- VoiceKeyerStartTx();
+ VoiceKeyerProcessEvent(VK_START);
event.Skip();
}
g_sfPlayFile = sf_open(wxGetApp().m_txtVoiceKeyerWaveFile, SFM_READ, &sfInfo);
if(g_sfPlayFile == NULL) {
wxString strErr = sf_strerror(NULL);
- wxMessageBox(strErr, wxT("Couldn't open voice keyer wave file"), wxOK);
+ wxMessageBox(strErr, wxT("Couldn't open:") + wxGetApp().m_txtVoiceKeyerWaveFile, wxOK);
m_togBtnVoiceKeyer->SetValue(false);
next_state = VK_IDLE;
}
void MainFrame::VoiceKeyerProcessEvent(int vk_event) {
int next_state = vk_state;
- switch(vk_state) {
+ switch(vk_state) {
- case VK_IDLE:
+ case VK_IDLE:
if (vk_event == VK_START) {
// sample these puppies at start just in case they are changed while VK running
vk_rx_pause = wxGetApp().m_intVoiceKeyerRxPause;
vk_repeats = wxGetApp().m_intVoiceKeyerRepeats;
+ fprintf(stderr, "vk_rx_pause: %d vk_repeats: %d\n", vk_rx_pause, vk_repeats);
vk_repeat_counter = 0;
next_state = VoiceKeyerStartTx();
}
break;
- case VK_TX:
+ case VK_TX:
// In this state we are transmitting and playing a wave file
// to Mic In
m_togBtnVoiceKeyer->SetValue(false);
next_state = VK_IDLE;
}
- vk_rx_time = 0.0;
- next_state = VK_RX;
+ else {
+ vk_rx_time = 0.0;
+ next_state = VK_RX;
+ }
}
break;
- case VK_RX:
+ case VK_RX:
// in this state we are receiving and waiting for
// delay timer or valid sync
}
break;
- case VK_SYNC_WAIT:
+ case VK_SYNC_WAIT:
// In this state we wait for valid sync to last
// VK_SYNC_WAIT_TIME seconds
m_btnTogPTT->SetValue(false); togglePTT();
m_togBtnVoiceKeyer->SetValue(false);
next_state = VK_IDLE;
- }
+ }
- fprintf(stderr, "VoiceKeyerProcessEvent: vk_state: %d vk_event: %d next_state: %d\n", vk_state, vk_event, next_state);
+ if ((vk_event != VK_DT) || (vk_state != next_state))
+ fprintf(stderr, "VoiceKeyerProcessEvent: vk_state: %d vk_event: %d next_state: %d vk_repeat_counter: %d\n", vk_state, vk_event, next_state, vk_repeat_counter);
vk_state = next_state;
}
m_togBtnAnalog->Enable();
m_togBtnOnOff->SetLabel(wxT("Stop"));
m_btnTogPTT->Enable();
+ m_togBtnVoiceKeyer->Enable();
m_rb1600->Disable();
m_rb700b->Disable();
//m_togTxID->Disable();
m_togBtnAnalog->Disable();
m_btnTogPTT->Disable();
+ m_togBtnVoiceKeyer->Disable();
m_togBtnOnOff->SetLabel(wxT("Start"));
m_rb1600->Enable();
m_rb700b->Enable();
}
sprintf(reply,"ok\n");
}
+ if (bufstr.StartsWith(_("ptton"), &itemToSet)) {
+ // note: if options dialog is open this will get overwritten
+ m_btnTogPTT->SetValue(true);
+ togglePTT();
+ sprintf(reply,"ok\n");
+ }
+ if (bufstr.StartsWith(_("pttoff"), &itemToSet)) {
+ // note: if options dialog is open this will get overwritten
+ m_btnTogPTT->SetValue(false);
+ togglePTT();
+ sprintf(reply,"ok\n");
+ }
}
else {
int PollUDP();
bool m_schedule_restore;
+ void VoiceKeyerProcessEvent(int vk_event);
+
protected:
#ifdef _WIN32
void OnIdle(wxIdleEvent &evt);
#endif
- void VoiceKeyerProcessEvent(int vk_event);
int VoiceKeyerStartTx(void);
private:
m_togBtnOnOff->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnOnOff), NULL, this);
m_togBtnSplit->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnSplitClick), NULL, this);
m_togBtnAnalog->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnAnalogClick), NULL, this);
- m_togBtnAnalog->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnVoiceKeyerClick), NULL, this);
+ m_togBtnVoiceKeyer->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnVoiceKeyerClick), NULL, this);
#ifdef ALC
m_togBtnALC->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
#endif
m_togBtnOnOff->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnOnOff), NULL, this);
m_togBtnSplit->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnSplitClick), NULL, this);
m_togBtnAnalog->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnAnalogClick), NULL, this);
- m_togBtnAnalog->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnVoiceKeyerClick), NULL, this);
+ m_togBtnVoiceKeyer->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnVoiceKeyerClick), NULL, this);
#ifdef ALC
m_togBtnALC->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
#endif