Change menu type (selectable functions)

This commit is contained in:
phdlee 2018-07-17 21:10:45 +09:00
parent c27bbf1b6b
commit 4ee3631db0
4 changed files with 270 additions and 74 deletions

View File

@ -36,7 +36,7 @@
#define I2C_LCD_SECOND_ADDRESS_DEFAULT 0x3F //0x27 //only using Dual LCD Mode
//Select betwen Analog S-Meter and DSP (I2C) Meter
//#define USE_I2CSMETER
#define USE_I2CSMETER
#define EXTEND_KEY_GROUP1 //MODE, BAND(-), BAND(+), STEP
//#define EXTEND_KEY_GROUP2 //Numeric (0~9), Point(.), Enter //Not supported in Version 1.0x
@ -47,9 +47,90 @@
extern byte I2C_LCD_MASTER_ADDRESS; //0x27 //if Set I2C Address by uBITX Manager, read from EEProm
extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define SMeterLatency 3 //1 is 0.25 sec
//==============================================================================
// User Select feather list
//==============================================================================
//Enable all features
#define FN_BAND 1 //592
#define FN_VFO_TOGGLE 1 //78
#define FN_MODE 1 //20
#define FN_RIT 1 //58
#define FN_SPLIT 1 //62
#define FN_IFSHIFT 1 //238
#define FN_ATT 1 //128
#define FN_CW_SPEED 1 //152
#define FN_VFOTOMEM 1 //254
#define FN_MEMTOVFO 1 //188
#define FN_MEMORYKEYER 1 //156
#define FN_WSPR 1 //1044
#define FN_SDRMODE 1 //68
#define FN_CALIBRATION 1 //666
#define FN_CARRIER 1 //382
#define FN_CWCARRIER 1 //346
#define FN_CWTONE 1 //148
#define FN_CWDELAY 1 //98
#define FN_TXCWDELAY 1 //94
#define FN_KEYTYPE 1 //168
#define FN_ADCMONITOR 1 //516
#define FN_TXONOFF 1 //58
/*
//Recommended Character LCD Developer 87%
#define FN_BAND 1 //592
#define FN_VFO_TOGGLE 1 //78
#define FN_MODE 1 //20
#define FN_RIT 1 //58
#define FN_SPLIT 1 //62
#define FN_IFSHIFT 1 //238
#define FN_ATT 0 //128
#define FN_CW_SPEED 0 //152 //using MM
#define FN_VFOTOMEM 1 //254
#define FN_MEMTOVFO 1 //188
#define FN_MEMORYKEYER 1 //156
#define FN_WSPR 1 //1044
#define FN_SDRMODE 1 //68
#define FN_CALIBRATION 0 //667 //using MM
#define FN_CARRIER 0 //382 //using MM
#define FN_CWCARRIER 0 //346 //using MM
#define FN_CWTONE 0 //148 //using MM
#define FN_CWDELAY 0 //98 //using MM
#define FN_TXCWDELAY 0 //94 //using MM
#define FN_KEYTYPE 0 //168 //using MM
#define FN_ADCMONITOR 0 //516 //using MM
#define FN_TXONOFF 1 //58
*/
/*
//Recommended for Nextion, TJC LCD 88%
#define FN_BAND 1 //600
#define FN_VFO_TOGGLE 1 //90
#define FN_MODE 1 //318
#define FN_RIT 1 //62
#define FN_SPLIT 1 //2
#define FN_IFSHIFT 1 //358
#define FN_ATT 1 //250
#define FN_CW_SPEED 0 //286
#define FN_VFOTOMEM 0 //276
#define FN_MEMTOVFO 0 //234
#define FN_MEMORYKEYER 1 //168
#define FN_WSPR 1 //1130
#define FN_SDRMODE 1 //70
#define FN_CALIBRATION 0 //790
#define FN_CARRIER 0 //500
#define FN_CWCARRIER 0 //464
#define FN_CWTONE 0 //158
#define FN_CWDELAY 0 //108
#define FN_TXCWDELAY 0 //106
#define FN_KEYTYPE 0 //294
#define FN_ADCMONITOR 0 //526 //not available with Nextion or Serial UI
#define FN_TXONOFF 1 //70
*/
//==============================================================================
// End of User Select Mode and Compil options
//==============================================================================
#ifdef UBITX_DISPLAY_LCD1602I
#define USE_I2C_LCD
#elif defined(UBITX_DISPLAY_LCD1602I_DUAL)

View File

@ -682,74 +682,7 @@ void checkButton(){
menuRitToggle(1);
break;
}
/*
if (keyStatus == FKEY_MODE) //Press Mode Key
{
if (cwMode == 1)
{
cwMode = 2;
}
else if (cwMode == 2)
{
cwMode = 0;
isUSB = 0;
}
else if (isUSB == 0)
{
isUSB = 1;
}
else
{
cwMode = 1;
}
}
else if (keyStatus == FKEY_BANDUP || keyStatus == FKEY_BANDDOWN) //Press Mode Key
{
char currentBandIndex = -1;
//Save Band Information
if (tuneTXType == 2 || tuneTXType == 3 || tuneTXType == 102 || tuneTXType == 103) { //only ham band move
currentBandIndex = getIndexHambanBbyFreq(frequency);
if (currentBandIndex >= 0) {
saveBandFreqByIndex(frequency, modeToByte(), currentBandIndex);
}
}
setNextHamBandFreq(frequency, keyStatus == FKEY_BANDDOWN ? -1 : 1); //Prior Band
}
else if (keyStatus == FKEY_STEP) //FKEY_BANDUP
{
if (++tuneStepIndex > 5)
tuneStepIndex = 1;
EEPROM.put(TUNING_STEP, tuneStepIndex);
printLine2ClearAndUpdate();
}
else if (keyStatus == FKEY_VFOCHANGE)
{
menuVfoToggle(1); //Vfo Toggle
}
else if (keyStatus == FKEY_SPLIT)
{
menuSplitOnOff(1);
}
else if (keyStatus == FKEY_TXOFF)
{
menuTxOnOff(1, 0x01);
}
else if (keyStatus == FKEY_SDRMODE)
{
menuSDROnOff(1);
}
else if (keyStatus == FKEY_RIT)
{
menuRitToggle(1);
}
*/
FrequencyToVFO(1);
SetCarrierFreq();
setFrequency(frequency);

View File

@ -1113,7 +1113,190 @@ void doMenu(){
//Below codes are origial code with modified by KD8CEC
menuOn = 2;
TriggerBySW = 0; //Nextion LCD and Other MCU
//*********************************************************************************
// New type menu for developer by KD8CEC
// Selectable menu
// Version : 1.097 ~
//*********************************************************************************
#ifndef ENABLE_ADCMONITOR
#define FN_ADCMONITOR 0
#endif
#define FN_DEFAULT_MENU 2 //Setup Onff / Exit
#define FN_DEFAULT_SETUP 1 //Exit
#define FN_BAND_IDX (FN_BAND -1) //0 or -1
#define FN_VFO_TOGGLE_IDX (FN_BAND_IDX + FN_VFO_TOGGLE)
#define FN_MODE_IDX (FN_VFO_TOGGLE_IDX + FN_MODE)
#define FN_RIT_IDX (FN_MODE_IDX + FN_RIT)
#define FN_IFSHIFT_IDX (FN_RIT_IDX + FN_IFSHIFT)
#define FN_ATT_IDX (FN_IFSHIFT_IDX + FN_ATT)
#define FN_CW_SPEED_IDX (FN_ATT_IDX + FN_CW_SPEED)
#define FN_SPLIT_IDX (FN_CW_SPEED_IDX + FN_SPLIT)
#define FN_VFOTOMEM_IDX (FN_SPLIT_IDX + FN_VFOTOMEM)
#define FN_MEMTOVFO_IDX (FN_VFOTOMEM_IDX + FN_MEMTOVFO)
#define FN_MEMORYKEYER_IDX (FN_MEMTOVFO_IDX + FN_MEMORYKEYER)
#define FN_WSPR_IDX (FN_MEMORYKEYER_IDX + FN_WSPR)
#define FN_SDRMODE_IDX (FN_WSPR_IDX + FN_SDRMODE)
#define FN_SETUP_IDX (FN_SDRMODE_IDX + 1)
#define FN_EXIT_IDX (FN_SETUP_IDX + 1)
#define FN_CALIBRATION_IDX (FN_EXIT_IDX + FN_CALIBRATION)
#define FN_CARRIER_IDX (FN_CALIBRATION_IDX + FN_CARRIER)
#define FN_CWCARRIER_IDX (FN_CARRIER_IDX + FN_CWCARRIER)
#define FN_CWTONE_IDX (FN_CWCARRIER_IDX + FN_CWTONE)
#define FN_CWDELAY_IDX (FN_CWTONE_IDX + FN_CWDELAY)
#define FN_TXCWDELAY_IDX (FN_CWDELAY_IDX + FN_TXCWDELAY)
#define FN_KEYTYPE_IDX (FN_TXCWDELAY_IDX + FN_KEYTYPE)
#define FN_ADCMONITOR_IDX (FN_KEYTYPE_IDX + FN_ADCMONITOR)
#define FN_TXONOFF_IDX (FN_ADCMONITOR_IDX + FN_TXONOFF)
#define FN_MENU_COUNT (FN_DEFAULT_MENU + FN_BAND + FN_VFO_TOGGLE + FN_MODE + FN_RIT + FN_IFSHIFT + FN_ATT + FN_CW_SPEED + FN_SPLIT + FN_VFOTOMEM + FN_MEMTOVFO + FN_MEMORYKEYER + FN_WSPR + FN_SDRMODE)
#define FN_SETUP_COUNT (FN_DEFAULT_SETUP + FN_CALIBRATION + FN_CARRIER + FN_CWCARRIER + FN_CWTONE + FN_CWDELAY + FN_TXCWDELAY + FN_KEYTYPE + FN_ADCMONITOR + FN_TXONOFF)
#define FN_STEP_COUNT (FN_MENU_COUNT + FN_SETUP_COUNT)
while (menuOn){
i = enc_read();
btnState = btnDown();
if (i > 0){
if (modeCalibrate && select + i < FN_STEP_COUNT * 10)
select += i;
else if (!modeCalibrate && select + i < FN_MENU_COUNT * 10)
select += i;
}
else if (i < 0 && select - i >= -10)
select += i;
switch (select / 10)
{
#if FN_BAND == 1
case FN_BAND_IDX :
menuBand(btnState);
break;
#endif
#if FN_VFO_TOGGLE == 1
case FN_VFO_TOGGLE_IDX :
menuVfoToggle(btnState);
break;
#endif
#if FN_MODE == 1
case FN_MODE_IDX :
menuSelectMode(btnState);
break;
#endif
#if FN_RIT == 1
case FN_RIT_IDX :
menuRitToggle(btnState);
break;
#endif
#if FN_IFSHIFT == 1
case FN_IFSHIFT_IDX :
menuIFSSetup(btnState);
break;
#endif
#if FN_ATT == 1
case FN_ATT_IDX :
menuATTSetup(btnState);
break;
#endif
#if FN_CW_SPEED == 1
case FN_CW_SPEED_IDX :
menuCWSpeed(btnState);
break;
#endif
#if FN_SPLIT == 1
case FN_SPLIT_IDX :
menuSplitOnOff(btnState); //SplitOn / off
break;
#endif
#if FN_VFOTOMEM == 1
case FN_VFOTOMEM_IDX :
menuCHMemory(btnState, 0); //VFO to Memroy
break;
#endif
#if FN_MEMTOVFO == 1
case FN_MEMTOVFO_IDX :
menuCHMemory(btnState, 1); //Memory to VFO
break;
#endif
#if FN_MEMORYKEYER == 1
case FN_MEMORYKEYER_IDX :
menuCWAutoKey(btnState);
break;
#endif
#if FN_WSPR == 1
case FN_WSPR_IDX :
menuWSPRSend(btnState);
break;
#endif
#if FN_SDRMODE == 1
case FN_SDRMODE_IDX :
menuSDROnOff(btnState);
break;
#endif
case FN_SETUP_IDX :
menuSetup(btnState);
break;
case FN_EXIT_IDX :
menuExit(btnState);
break;
#if FN_CALIBRATION == 1
case FN_CALIBRATION_IDX :
menuSetupCalibration(btnState); //crystal
break;
#endif
#if FN_CARRIER == 1
case FN_CARRIER_IDX :
menuSetupCarrier(btnState); //ssb
break;
#endif
#if FN_CWCARRIER == 1
case FN_CWCARRIER_IDX :
menuSetupCWCarrier(btnState); //cw
break;
#endif
#if FN_CWTONE == 1
case FN_CWTONE_IDX :
menuSetupCwTone(btnState);
break;
#endif
#if FN_CWDELAY == 1
case FN_CWDELAY_IDX :
menuSetupCwDelay(btnState);
break;
#endif
#if FN_TXCWDELAY == 1
case FN_TXCWDELAY_IDX :
menuSetupTXCWInterval(btnState);
break;
#endif
#if FN_KEYTYPE == 1
case FN_KEYTYPE_IDX :
menuSetupKeyType(btnState);
break;
#endif
#if FN_ADCMONITOR == 1
case FN_ADCMONITOR_IDX :
menuADCMonitor(btnState);
break;
#endif
#if FN_TXONOFF == 1
case FN_TXONOFF_IDX :
menuTxOnOff(btnState, 0x01); //TX OFF / ON
break;
#endif
default :
menuExit(btnState); break;
} //end of switch
Check_Cat(0); //To prevent disconnections
} //end of while
//****************************************************************************
//Before change menu type (Version : ~ 0.95)
//****************************************************************************
/*
while (menuOn){
i = enc_read();
btnState = btnDown();
@ -1208,9 +1391,10 @@ void doMenu(){
break;
default :
menuExit(btnState); break;
}
} //end of case
Check_Cat(0); //To prevent disconnections
}
} //end of while
*/
}
//*************************************************************************************

View File

@ -6,8 +6,6 @@ Thanks to G3ZIL for sharing great code.
Due to the limited memory of uBITX, I have implemented at least only a few of the codes in uBITX.
Thanks for testing
Beta Tester :
-----------------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by