mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-11-18 17:56:00 -05:00
Move CW WPM and Hz to setup menu
This commit is contained in:
parent
b100da145e
commit
bc83bcd5d1
63
setup.cpp
63
setup.cpp
@ -161,7 +161,6 @@ void setupCwDelay(){
|
|||||||
|
|
||||||
displayDialog(F("Set CW T/R Delay"),F("Press tune to Save"));
|
displayDialog(F("Set CW T/R Delay"),F("Press tune to Save"));
|
||||||
|
|
||||||
active_delay(500);
|
|
||||||
prev_cw_delay = globalSettings.cwActiveTimeoutMs;
|
prev_cw_delay = globalSettings.cwActiveTimeoutMs;
|
||||||
|
|
||||||
ltoa(globalSettings.cwActiveTimeoutMs, b, 10);
|
ltoa(globalSettings.cwActiveTimeoutMs, b, 10);
|
||||||
@ -185,7 +184,6 @@ void setupCwDelay(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SaveSettingsToEeprom();
|
SaveSettingsToEeprom();
|
||||||
active_delay(500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void formatKeyerEnum(char* output, const KeyerMode_e mode)
|
void formatKeyerEnum(char* output, const KeyerMode_e mode)
|
||||||
@ -233,6 +231,59 @@ void setupKeyer(){
|
|||||||
SaveSettingsToEeprom();
|
SaveSettingsToEeprom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupCwSpeed()
|
||||||
|
{
|
||||||
|
displayDialog(F("Set CW Speed (WPM)"),F("Press tune to Save"));
|
||||||
|
|
||||||
|
unsigned int wpm = 1200/globalSettings.cwDitDurationMs;
|
||||||
|
|
||||||
|
itoa(wpm, b, 10);
|
||||||
|
displayText(b, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_SETTING_BACKGROUND, COLOR_BACKGROUND);
|
||||||
|
|
||||||
|
while (!btnDown()){
|
||||||
|
int knob = enc_read();
|
||||||
|
|
||||||
|
if (knob < 0 && wpm > 1)
|
||||||
|
--wpm;
|
||||||
|
else if (knob > 0 && wpm < 100)
|
||||||
|
++wpm;
|
||||||
|
else
|
||||||
|
continue;//don't update the frequency or the display
|
||||||
|
|
||||||
|
itoa(wpm, b, 10);
|
||||||
|
displayText(b, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_SETTING_BACKGROUND, COLOR_BACKGROUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
globalSettings.cwDitDurationMs = 1200/wpm;
|
||||||
|
SaveSettingsToEeprom();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupCwTone(){
|
||||||
|
displayDialog(F("Set CW Tone (Hz)"),F("Press tune to Save"));
|
||||||
|
|
||||||
|
tone(CW_TONE, globalSettings.cwSideToneFreq);
|
||||||
|
itoa(globalSettings.cwSideToneFreq, b, 10);
|
||||||
|
displayText(b, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_SETTING_BACKGROUND, COLOR_BACKGROUND);
|
||||||
|
|
||||||
|
while(!btnDown()){
|
||||||
|
int knob = enc_read();
|
||||||
|
|
||||||
|
if (knob > 0 && globalSettings.cwSideToneFreq < 2000)
|
||||||
|
globalSettings.cwSideToneFreq += 10;
|
||||||
|
else if (knob < 0 && globalSettings.cwSideToneFreq > 100 )
|
||||||
|
globalSettings.cwSideToneFreq -= 10;
|
||||||
|
else
|
||||||
|
continue; //don't update the frequency or the display
|
||||||
|
|
||||||
|
tone(CW_TONE, globalSettings.cwSideToneFreq);
|
||||||
|
itoa(globalSettings.cwSideToneFreq, b, 10);
|
||||||
|
displayText(b, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_SETTING_BACKGROUND, COLOR_BACKGROUND);
|
||||||
|
}
|
||||||
|
noTone(CW_TONE);
|
||||||
|
|
||||||
|
SaveSettingsToEeprom();
|
||||||
|
}
|
||||||
|
|
||||||
struct MenuItem_t {
|
struct MenuItem_t {
|
||||||
const char* const ItemName;
|
const char* const ItemName;
|
||||||
const void (*OnSelect)();
|
const void (*OnSelect)();
|
||||||
@ -242,8 +293,8 @@ void runMenu(const MenuItem_t* const menu_items, const uint16_t num_items);
|
|||||||
#define RUN_MENU(menu) runMenu(menu,sizeof(menu)/sizeof(menu[0]))
|
#define RUN_MENU(menu) runMenu(menu,sizeof(menu)/sizeof(menu[0]))
|
||||||
|
|
||||||
const char MT_CAL [] PROGMEM = "Calibrations";
|
const char MT_CAL [] PROGMEM = "Calibrations";
|
||||||
const char MI_SET_FREQ [] PROGMEM = "Local Osc Frequency";
|
const char MI_SET_FREQ [] PROGMEM = "Local Oscillator";
|
||||||
const char MI_SET_BFO [] PROGMEM = "Beat Osc Frequency";
|
const char MI_SET_BFO [] PROGMEM = "Beat Frequency Osc (BFO)";
|
||||||
const char MI_TOUCH [] PROGMEM = "Touch Screen";
|
const char MI_TOUCH [] PROGMEM = "Touch Screen";
|
||||||
const MenuItem_t calibrationMenu [] PROGMEM {
|
const MenuItem_t calibrationMenu [] PROGMEM {
|
||||||
{MT_CAL,nullptr},//Title
|
{MT_CAL,nullptr},//Title
|
||||||
@ -254,10 +305,14 @@ const MenuItem_t calibrationMenu [] PROGMEM {
|
|||||||
void runCalibrationMenu(){RUN_MENU(calibrationMenu);}
|
void runCalibrationMenu(){RUN_MENU(calibrationMenu);}
|
||||||
|
|
||||||
const char MT_CW [] PROGMEM = "CW/Morse Setup";
|
const char MT_CW [] PROGMEM = "CW/Morse Setup";
|
||||||
|
const char MI_CW_SPEED [] PROGMEM = "Play Speed (WPM)";
|
||||||
|
const char MI_CW_TONE [] PROGMEM = "Tone Frequency";
|
||||||
const char MI_CW_DELAY [] PROGMEM = "Tx/Rx Switching Delay";
|
const char MI_CW_DELAY [] PROGMEM = "Tx/Rx Switching Delay";
|
||||||
const char MI_CW_KEYER [] PROGMEM = "Keyer Type";
|
const char MI_CW_KEYER [] PROGMEM = "Keyer Type";
|
||||||
const MenuItem_t cwMenu [] PROGMEM {
|
const MenuItem_t cwMenu [] PROGMEM {
|
||||||
{MT_CW,nullptr},//Title
|
{MT_CW,nullptr},//Title
|
||||||
|
{MI_CW_SPEED,setupCwSpeed},
|
||||||
|
{MI_CW_TONE,setupCwTone},
|
||||||
{MI_CW_DELAY,setupCwDelay},
|
{MI_CW_DELAY,setupCwDelay},
|
||||||
{MI_CW_KEYER,setupKeyer},
|
{MI_CW_KEYER,setupKeyer},
|
||||||
};
|
};
|
||||||
|
68
ubitx_ui.cpp
68
ubitx_ui.cpp
@ -65,7 +65,7 @@ enum btn_set_e {
|
|||||||
BUTTON_17,
|
BUTTON_17,
|
||||||
BUTTON_15,
|
BUTTON_15,
|
||||||
BUTTON_10,
|
BUTTON_10,
|
||||||
BUTTON_WPM,
|
BUTTON_BLANK_1,
|
||||||
BUTTON_MNU,
|
BUTTON_MNU,
|
||||||
BUTTON_FRQ,
|
BUTTON_FRQ,
|
||||||
BUTTON_TOTAL
|
BUTTON_TOTAL
|
||||||
@ -96,7 +96,7 @@ constexpr Button btn_set[BUTTON_TOTAL] PROGMEM = {
|
|||||||
|
|
||||||
{LAYOUT_BUTTON_X + 0*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_15 , "15", '5'},
|
{LAYOUT_BUTTON_X + 0*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_15 , "15", '5'},
|
||||||
{LAYOUT_BUTTON_X + 1*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_10 , "10", '1'},
|
{LAYOUT_BUTTON_X + 1*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_10 , "10", '1'},
|
||||||
{LAYOUT_BUTTON_X + 2*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_WPM, "WPM", 'W'},
|
{LAYOUT_BUTTON_X + 2*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_BLANK_1, "", '\0'},
|
||||||
{LAYOUT_BUTTON_X + 3*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_MNU, "MNU", 'M'},
|
{LAYOUT_BUTTON_X + 3*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_MNU, "MNU", 'M'},
|
||||||
{LAYOUT_BUTTON_X + 4*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_FRQ, "FRQ", 'F'},
|
{LAYOUT_BUTTON_X + 4*LAYOUT_BUTTON_PITCH_X, LAYOUT_BUTTON_Y + 2*LAYOUT_BUTTON_PITCH_Y, LAYOUT_BUTTON_WIDTH, LAYOUT_BUTTON_HEIGHT, BUTTON_FRQ, "FRQ", 'F'},
|
||||||
};
|
};
|
||||||
@ -808,65 +808,6 @@ void switchBand(uint32_t bandfreq){
|
|||||||
saveVFOs();
|
saveVFOs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCwSpeed()
|
|
||||||
{
|
|
||||||
int wpm = 1200/globalSettings.cwDitDurationMs;
|
|
||||||
|
|
||||||
wpm = getValueByKnob(1, 100, 1, wpm,F("CW: "),F(" WPM"));
|
|
||||||
|
|
||||||
globalSettings.cwDitDurationMs = 1200/wpm;
|
|
||||||
SaveSettingsToEeprom();
|
|
||||||
active_delay(500);
|
|
||||||
drawStatusbar();
|
|
||||||
//printLine2("");
|
|
||||||
//updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCwTone(){
|
|
||||||
int knob = 0;
|
|
||||||
int prev_sideTone;
|
|
||||||
|
|
||||||
tone(CW_TONE, globalSettings.cwSideToneFreq);
|
|
||||||
itoa(globalSettings.cwSideToneFreq, c, 10);
|
|
||||||
strcpy_P(b,(const char*)F("CW Tone: "));
|
|
||||||
strcat(b, c);
|
|
||||||
strcat_P(b,(const char*)F(" Hz"));
|
|
||||||
drawCommandbar(b);
|
|
||||||
|
|
||||||
//disable all clock 1 and clock 2
|
|
||||||
while (digitalRead(PTT) == HIGH && !btnDown())
|
|
||||||
{
|
|
||||||
knob = enc_read();
|
|
||||||
|
|
||||||
if (knob > 0 && globalSettings.cwSideToneFreq < 2000)
|
|
||||||
globalSettings.cwSideToneFreq += 10;
|
|
||||||
else if (knob < 0 && globalSettings.cwSideToneFreq > 100 )
|
|
||||||
globalSettings.cwSideToneFreq -= 10;
|
|
||||||
else
|
|
||||||
continue; //don't update the frequency or the display
|
|
||||||
|
|
||||||
tone(CW_TONE, globalSettings.cwSideToneFreq);
|
|
||||||
itoa(globalSettings.cwSideToneFreq, c, 10);
|
|
||||||
strcpy_P(b,(const char*)F("CW Tone: "));
|
|
||||||
strcat(b, c);
|
|
||||||
strcat_P(b,(const char*)F(" Hz"));
|
|
||||||
drawCommandbar(b);
|
|
||||||
//printLine2(b);
|
|
||||||
|
|
||||||
checkCAT();
|
|
||||||
active_delay(20);
|
|
||||||
}
|
|
||||||
noTone(CW_TONE);
|
|
||||||
|
|
||||||
SaveSettingsToEeprom();
|
|
||||||
|
|
||||||
b[0] = 0;
|
|
||||||
drawCommandbar(b);
|
|
||||||
drawStatusbar();
|
|
||||||
//printLine2("");
|
|
||||||
//updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void doCommand(Button* button){
|
void doCommand(Button* button){
|
||||||
//Serial.print(F("Doing command: "));
|
//Serial.print(F("Doing command: "));
|
||||||
//Serial.print(button->text);
|
//Serial.print(button->text);
|
||||||
@ -957,11 +898,6 @@ void doCommand(Button* button){
|
|||||||
enterFreq();
|
enterFreq();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BUTTON_WPM:
|
|
||||||
{
|
|
||||||
setCwSpeed();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BUTTON_MNU:
|
case BUTTON_MNU:
|
||||||
{
|
{
|
||||||
doSetup2();
|
doSetup2();
|
||||||
|
Loading…
Reference in New Issue
Block a user