Compare commits

..

8 Commits

5 changed files with 85 additions and 21 deletions

View File

@@ -1,3 +1,12 @@
#KC4UPR'S NOTE
----------------------------------------------------------------------------
This is a fork of the KD8CEC firmware that will be specific to my uBITX V5
installation. My intent is to remove unnecessary code, as well as make some
GPIO changes based on my use of the Nextion LCD. Specifically, I'd like to
eliminate the use of analog I/O for reading the CW keys, and possibly enable
control of accessories such as filters using the extra GPIO pins that are
now available.
#NOTICE #NOTICE
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
- Now Release Version 1.20 on my blog (http://www.hamskey.com) - Now Release Version 1.20 on my blog (http://www.hamskey.com)

View File

@@ -27,21 +27,24 @@
//Depending on the type of LCD mounted on the uBITX, uncomment one of the options below. //Depending on the type of LCD mounted on the uBITX, uncomment one of the options below.
//You must select only one. //You must select only one.
#define UBITX_DISPLAY_LCD1602P //LCD mounted on unmodified uBITX (Parallel) //#define UBITX_DISPLAY_LCD1602P //LCD mounted on unmodified uBITX (Parallel)
//#define UBITX_DISPLAY_LCD1602I //I2C type 16 x 02 LCD //#define UBITX_DISPLAY_LCD1602I //I2C type 16 x 02 LCD
//#define UBITX_DISPLAY_LCD1602I_DUAL //I2C type 16 x02 LCD Dual //#define UBITX_DISPLAY_LCD1602I_DUAL //I2C type 16 x02 LCD Dual
//#define UBITX_DISPLAY_LCD2004P //24 x 04 LCD (Parallel) //#define UBITX_DISPLAY_LCD2004P //24 x 04 LCD (Parallel)
//#define UBITX_DISPLAY_LCD2004I //I2C type 24 x 04 LCD //#define UBITX_DISPLAY_LCD2004I //I2C type 24 x 04 LCD
//#define UBITX_DISPLAY_NEXTION //NEXTION LCD #define UBITX_DISPLAY_NEXTION //NEXTION LCD
//#define UBITX_DISPLAY_NEXTION_SAFE //Only EEProm Write 770~775 //#define UBITX_DISPLAY_NEXTION_SAFE //Only EEProm Write 770~775
#define I2C_LCD_MASTER_ADDRESS_DEFAULT 0x27 //0x27 //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm #define I2C_LCD_MASTER_ADDRESS_DEFAULT 0x27 //0x27 //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm
#define I2C_LCD_SECOND_ADDRESS_DEFAULT 0x3F //0x27 //only using Dual LCD Mode #define I2C_LCD_SECOND_ADDRESS_DEFAULT 0x3F //0x27 //only using Dual LCD Mode
//Select betwen Analog S-Meter and DSP (I2C) Meter //Select betwen Analog S-Meter and DSP (I2C) Meter
#define USE_I2CSMETER //#define USE_I2CSMETER
#define EXTEND_KEY_GROUP1 //MODE, BAND(-), BAND(+), STEP // Use alternate keyer?
#define USE_ALTKEYER
//#define EXTEND_KEY_GROUP1 //MODE, BAND(-), BAND(+), STEP
//#define EXTEND_KEY_GROUP2 //Numeric (0~9), Point(.), Enter //Not supported in Version 1.0x //#define EXTEND_KEY_GROUP2 //Numeric (0~9), Point(.), Enter //Not supported in Version 1.0x
//Custom LPF Filter Mod //Custom LPF Filter Mod
@@ -58,6 +61,7 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
//============================================================================== //==============================================================================
// User Select feather list // User Select feather list
//============================================================================== //==============================================================================
/*
//Enable all features //Enable all features
#define FN_BAND 1 //592 #define FN_BAND 1 //592
#define FN_VFO_TOGGLE 1 //78 #define FN_VFO_TOGGLE 1 //78
@@ -81,7 +85,7 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define FN_KEYTYPE 1 //168 #define FN_KEYTYPE 1 //168
#define FN_ADCMONITOR 1 //516 #define FN_ADCMONITOR 1 //516
#define FN_TXONOFF 1 //58 #define FN_TXONOFF 1 //58
*/
/* /*
//Test Configuration (88%) //Test Configuration (88%)
#define FN_BAND 0 //592 #define FN_BAND 0 //592
@@ -107,7 +111,6 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define FN_ADCMONITOR 1 //516 #define FN_ADCMONITOR 1 //516
#define FN_TXONOFF 1 //58 #define FN_TXONOFF 1 //58
*/ */
/* /*
//Recommended Character LCD Developer 87% //Recommended Character LCD Developer 87%
#define FN_BAND 1 //592 #define FN_BAND 1 //592
@@ -134,7 +137,6 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define FN_TXONOFF 1 //58 #define FN_TXONOFF 1 //58
*/ */
/*
//Recommended for Nextion, TJC LCD 88% //Recommended for Nextion, TJC LCD 88%
#define FN_BAND 1 //600 #define FN_BAND 1 //600
#define FN_VFO_TOGGLE 1 //90 #define FN_VFO_TOGGLE 1 //90
@@ -158,7 +160,7 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define FN_KEYTYPE 0 //294 #define FN_KEYTYPE 0 //294
#define FN_ADCMONITOR 0 //526 //not available with Nextion or Serial UI #define FN_ADCMONITOR 0 //526 //not available with Nextion or Serial UI
#define FN_TXONOFF 1 //70 #define FN_TXONOFF 1 //70
*/
//============================================================================== //==============================================================================
// End of User Select Mode and Compil options // End of User Select Mode and Compil options
//============================================================================== //==============================================================================
@@ -219,6 +221,12 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define ANALOG_SPARE (A7) #define ANALOG_SPARE (A7)
#define ANALOG_SMETER (A7) //by KD8CEC #define ANALOG_SMETER (A7) //by KD8CEC
#ifdef USE_ALTKEYER
#define DIGITAL_DOT (12)
#define DIGITAL_DASH (11)
#define DIGITAL_KEY (A3)
#endif
/** /**
* The second set of 16 pins on the Raduino's bottom connector are have the three clock outputs and the digital lines to control the rig. * The second set of 16 pins on the Raduino's bottom connector are have the three clock outputs and the digital lines to control the rig.
* This assignment is as follows : * This assignment is as follows :

View File

@@ -803,9 +803,17 @@ void checkButton(){
delay(50); delay(50);
if (!btnDown()) //debounce if (!btnDown()) //debounce
return; return;
//for touch screen
#ifdef USE_SW_SERIAL
SetSWActivePage(1);
doMenu(); doMenu();
if (isCWAutoMode == 0)
SetSWActivePage(0);
#else
doMenu();
#endif
//wait for the button to go up again //wait for the button to go up again
while(btnDown()) { while(btnDown()) {
delay(10); delay(10);
@@ -1292,6 +1300,12 @@ void initPorts(){
pinMode(ANALOG_KEYER, INPUT_PULLUP); pinMode(ANALOG_KEYER, INPUT_PULLUP);
pinMode(ANALOG_SMETER, INPUT); //by KD8CEC pinMode(ANALOG_SMETER, INPUT); //by KD8CEC
#ifdef USE_ALTKEYER
pinMode(DIGITAL_DOT, INPUT_PULLUP);
pinMode(DIGITAL_DASH, INPUT_PULLUP);
if (DIGITAL_KEY != PTT) pinMode(DIGITAL_KEY, INPUT_PULLUP);
#endif
#ifdef USE_CUSTOM_LPF_FILTER #ifdef USE_CUSTOM_LPF_FILTER
if (isCustomFilter_A7) if (isCustomFilter_A7)
{ {
@@ -1460,6 +1474,13 @@ void checkAutoSaveFreqMode()
void loop(){ void loop(){
if (isCWAutoMode == 0){ //when CW AutoKey Mode, disable this process if (isCWAutoMode == 0){ //when CW AutoKey Mode, disable this process
#ifdef USE_ALTKEYER
// when using the alternate keyer, don't check the PTT if we're in CW mode--assuming the pin is the same as PTT
if (DIGITAL_KEY == PTT) {
if (!txCAT && (cwMode == 0))
checkPTT();
} else
#endif
if (!txCAT) if (!txCAT)
checkPTT(); checkPTT();
checkButton(); checkButton();

View File

@@ -39,6 +39,20 @@ char lastPaddle = 0;
//reads the analog keyer pin and reports the paddle //reads the analog keyer pin and reports the paddle
byte getPaddle() { byte getPaddle() {
#ifdef USE_ALTKEYER
// Alternate keyer
if ((DIGITAL_KEY != PTT) || ((DIGITAL_KEY == PTT) && (cwMode > 0))) {
if (digitalRead(DIGITAL_KEY) == LOW) {
return PADDLE_STRAIGHT;
}
}
// paddles work whether or not CW mode is actually selected
int rv = 0;
rv |= digitalRead(DIGITAL_DOT) == LOW ? PADDLE_DOT : 0;
rv |= digitalRead(DIGITAL_DASH) == LOW ? PADDLE_DASH : 0;
return rv;
#else
int paddle = analogRead(ANALOG_KEYER); int paddle = analogRead(ANALOG_KEYER);
if (paddle > 800) // above 4v is up if (paddle > 800) // above 4v is up
@@ -52,6 +66,7 @@ byte getPaddle(){
return PADDLE_BOTH; //both are between 1 and 2v return PADDLE_BOTH; //both are between 1 and 2v
else else
return PADDLE_STRAIGHT; //less than 1v is the straight key return PADDLE_STRAIGHT; //less than 1v is the straight key
#endif
} }
/** /**
@@ -97,8 +112,21 @@ unsigned char keyerState = IDLE;
//create by KD8CEC for compatible with new CW Logic //create by KD8CEC for compatible with new CW Logic
char update_PaddleLatch(byte isUpdateKeyState) { char update_PaddleLatch(byte isUpdateKeyState) {
unsigned char tmpKeyerControl = 0; unsigned char tmpKeyerControl = 0;
int paddle = analogRead(ANALOG_KEYER);
#ifdef USE_ALTKEYER
// One big note... I have no idea how debounce does or doesn't affect this... but there is no debounce right now. It's conceivable
// that the normal uBITX use of an analog input for this masks bouncing...
if ((digitalRead(DIGITAL_DASH) == LOW)) tmpKeyerControl |= DAH_L;
if (Iambic_Key) {
if (digitalRead(DIGITAL_DOT) == LOW) tmpKeyerControl |= DIT_L;
} else {
// I really would like to have the PTT (during CW mode) just result in key down regardless of Iambic, but this doesn't do that yet...
if ((DIGITAL_KEY != PTT) || ((DIGITAL_KEY == PTT) && (cwMode > 0))) {
if (digitalRead(DIGITAL_KEY) == LOW) tmpKeyerControl |= DAH_L;
}
}
#else
int paddle = analogRead(ANALOG_KEYER);
if (paddle >= cwAdcDashFrom && paddle <= cwAdcDashTo) if (paddle >= cwAdcDashFrom && paddle <= cwAdcDashTo)
tmpKeyerControl |= DAH_L; tmpKeyerControl |= DAH_L;
else if (paddle >= cwAdcDotFrom && paddle <= cwAdcDotTo) else if (paddle >= cwAdcDotFrom && paddle <= cwAdcDotTo)
@@ -114,6 +142,7 @@ char update_PaddleLatch(byte isUpdateKeyState) {
else else
tmpKeyerControl = 0 ; tmpKeyerControl = 0 ;
} }
#endif
if (isUpdateKeyState == 1) if (isUpdateKeyState == 1)
keyerControl |= tmpKeyerControl; keyerControl |= tmpKeyerControl;
@@ -224,10 +253,9 @@ void cwKeyer(void){
Check_Cat(2); Check_Cat(2);
} //end of while } //end of while
} } else {
else{
while(1){ while(1){
if (update_PaddleLatch(0) == DIT_L) { if (update_PaddleLatch(0) == DAH_L) {
// if we are here, it is only because the key is pressed // if we are here, it is only because the key is pressed
if (!inTx){ if (!inTx){
//DelayTime Option //DelayTime Option
@@ -239,7 +267,7 @@ void cwKeyer(void){
} }
cwKeydown(); cwKeydown();
while ( update_PaddleLatch(0) == DIT_L ) while ( update_PaddleLatch(0) == DAH_L )
delay_background(1, 3); delay_background(1, 3);
cwKeyUp(); cwKeyUp();
@@ -365,5 +393,3 @@ void cwKeyer(){
} }
} }
*/ */

View File

@@ -1041,7 +1041,7 @@ void SendUbitxData(void)
EEPROM.get(EXTERNAL_DEVICE_OPT1, nextionDisplayOption); EEPROM.get(EXTERNAL_DEVICE_OPT1, nextionDisplayOption);
SendCommandUL(CMD_DISP_OPTION2, nextionDisplayOption); SendCommandUL(CMD_DISP_OPTION2, nextionDisplayOption);
SendCommandStr(CMD_VERSION, (char *)("+v1.122")); //Version SendCommandStr(CMD_VERSION, (char *)("+v1.200")); //Version
SendEEPromData(CMD_CALLSIGN, 0, userCallsignLength -1, 0); SendEEPromData(CMD_CALLSIGN, 0, userCallsignLength -1, 0);
/* /*