Compare commits

...

9 Commits

Author SHA1 Message Date
phdlee
7c8088f753 add comment 2018-05-23 15:58:50 +09:00
phdlee
67cdd14945 modified comments 2018-05-23 15:28:00 +09:00
phdlee
b375b7e9e4 modified some comments 2018-05-23 15:20:10 +09:00
phdlee
8a6e01e289 improve external switch check routine 2018-05-23 15:07:37 +09:00
phdlee
83dc1de18e fixed mode change 2018-05-22 11:37:10 +09:00
phdlee
65d21aba77 Fixed Band Select Bug 2018-05-09 16:53:49 +09:00
phdlee
6a2369bc27 Fixed Band Select Bug 2018-05-09 16:53:40 +09:00
phdlee
76d5c362d0 complete test for Factory Recovery 2018-05-07 14:08:22 +09:00
phdlee
70fc6aeba8 Add Factory Recovery function 2018-05-07 13:56:46 +09:00
9 changed files with 84 additions and 41 deletions

View File

@@ -10,7 +10,7 @@ I am getting a lot of hints from the group.
Ian KD8CEC
kd8cec@gmail.com
==================================================================
Files modified in Version1.074 Beta
Files modified in Version1.08 Beta
1.Delted Files.
@@ -25,6 +25,6 @@ Files modified in Version1.074 Beta
- ubitx_lcd_1602.ino
- ubitx_lcd_1602Dual.ino
- ubitx_lcd_2004.ino
-ubitx_wspr.ino
- ubitx_wspr.ino

View File

@@ -24,25 +24,26 @@
//==============================================================================
//Depending on the type of LCD mounted on the uBITX, uncomment one of the options below.
//You must select only one.
#define UBITX_DISPLAY_LCD1602P //LCD mounted on unmodified uBITX
//#define UBITX_DISPLAY_LCD1602I //I2C type 16 x 02 LCD
//#define UBITX_DISPLAY_LCD1602I_DUAL
//#define UBITX_DISPLAY_LCD2004P //24 x 04 LCD (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_DUAL //I2C type 16 x02 LCD Dual
//#define UBITX_DISPLAY_LCD2004P //24 x 04 LCD (Parallel)
//#define UBITX_DISPLAY_LCD2004I //I2C type 24 x 04 LCD
#define I2C_LCD_MASTER_ADDRESS_DEFAULT 0x3F //0x27 //DEFAULT, if Set I2C Address by uBITX Manager, read from EEProm
#define I2C_LCD_SECOND_ADDRESS_DEFAULT 0x27 //0x27 //only using Dual LCD Mode
#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_GROUP1 //MODE, BAND(-), BAND(+), STEP
//#define EXTEND_KEY_GROUP2 //Numeric (0~9), Point(.), Enter //Not supported in Version 1.0x
//#define ENABLE_FACTORYALIGN
#define ENABLE_ADCMONITOR //Starting with Version 1.07, you can read ADC values directly from uBITX Manager. So this function is not necessary.
#define FACTORY_RECOVERY_BOOTUP //Whether to enter Factory Recovery mode by pressing FKey and turning on power
#define ENABLE_ADCMONITOR //Starting with Version 1.07, you can read ADC values directly from uBITX Manager. So this function is not necessary.
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
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
#define SMeterLatency 3 //1 is 0.25 sec
#ifdef UBITX_DISPLAY_LCD1602I
#define USE_I2C_LCD
@@ -89,7 +90,6 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
#define ANALOG_SPARE (A7)
#define ANALOG_SMETER (A7) //by KD8CEC
/**
* 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 :
@@ -149,10 +149,10 @@ extern byte I2C_LCD_SECOND_ADDRESS; //only using Dual LCD Mode
extern unsigned long frequency;
extern byte WsprMSGCount;
extern byte sMeterLevels[9];
extern int currentSMeter; //ADC Value for S.Meter
extern byte scaledSMeter; //Calculated S.Meter Level
extern int currentSMeter; //ADC Value for S.Meter
extern byte scaledSMeter; //Calculated S.Meter Level
extern byte KeyValues[16][3]; //Set : Start Value, End Value, Key Type, 16 Set (3 * 16 = 48)
extern byte KeyValues[16][3]; //Set : Start Value, End Value, Key Type, 16 Set (3 * 16 = 48)
extern void printLine1(const char *c);
extern void printLine2(const char *c);

View File

@@ -6,8 +6,8 @@
// So I put + in the sense that it was improved one by one based on Original Firmware.
// This firmware has been gradually changed based on the original firmware created by Farhan, Jack, Jerry and others.
#define FIRMWARE_VERSION_INFO F("+v1.074")
#define FIRMWARE_VERSION_NUM 0x02 //1st Complete Project : 1 (Version 1.061), 2st Project : 2
#define FIRMWARE_VERSION_INFO F("+v1.080")
#define FIRMWARE_VERSION_NUM 0x03 //1st Complete Project : 1 (Version 1.061), 2st Project : 2
/**
Cat Suppoort uBITX CEC Version
@@ -254,8 +254,8 @@ void setNextHamBandFreq(unsigned long f, char moveDirection)
if ((resultFreq / 1000) < hamBandRange[(unsigned char)findedIndex][0] || (resultFreq / 1000) > hamBandRange[(unsigned char)findedIndex][1])
resultFreq = (unsigned long)(hamBandRange[(unsigned char)findedIndex][0]) * 1000;
setFrequency(resultFreq);
byteToMode(loadMode, 1);
setFrequency(resultFreq);
}
void saveBandFreqByIndex(unsigned long f, unsigned long mode, char bandIndex) {
@@ -941,6 +941,15 @@ void initSettings(){
if (EEPROM.read(VERSION_ADDRESS) != FIRMWARE_VERSION_NUM)
EEPROM.write(VERSION_ADDRESS, FIRMWARE_VERSION_NUM);
//Backup Calibration Setting from Factory Setup
//Check Factory Setting Backup Y/N
if (EEPROM.read(FACTORY_BACKUP_YN) != 0x13) {
EEPROM.write(FACTORY_BACKUP_YN, 0x13); //Set Backup Y/N
for (unsigned int i = 0; i < 32; i++) //factory setting range
EEPROM.write(FACTORY_VALUES + i, EEPROM.read(i)); //0~31 => 65~96
}
EEPROM.get(CW_CAL, cwmCarrier);
//for Save VFO_A_MODE to eeprom
@@ -1216,6 +1225,40 @@ void initPorts(){
digitalWrite(CW_KEY, 0);
}
//Recovery Factory Setting Values
void factory_Recovery()
{
if (EEPROM.read(FACTORY_BACKUP_YN) != 0x13)
return;
if (digitalRead(PTT) == 0) //Do not proceed if PTT is pressed to prevent malfunction.
return;
printLineF2(F("Factory Recovery"));
delay(2000);
if (!btnDown())
return;
printLineF2(F("IF you continue"));
printLineF1(F("release the key"));
delay(2000);
if (btnDown())
return;
printLineF1(F("Press Key PTT"));
delay(2000);
if (digitalRead(PTT) == 0)
{
for (unsigned int i = 0; i < 32; i++) //factory setting range
EEPROM.write(i, EEPROM.read(FACTORY_VALUES + i)); //65~96 => 0~31
//printLineF2(F("CompleteRecovery"));
printLineF1(F("Power Reset!"));
while(1); //Hold
}
}
void setup()
{
/*
@@ -1266,6 +1309,11 @@ void setup()
initPorts();
#ifdef FACTORY_RECOVERY_BOOTUP
if (btnDown())
factory_Recovery();
#endif
byteToMode(vfoA_mode, 0);
initOscillators();
@@ -1278,6 +1326,7 @@ void setup()
if (btnDown())
factory_alignment();
#endif
}
//Auto save Frequency and Mode with Protected eeprom life by KD8CEC

View File

@@ -44,7 +44,9 @@
// (Enabled if the EEProm address is insufficient)
// Address : 64 ~ 100
//==============================================================================
#define RESERVE_FOR_FACTORY2 64
#define RESERVE_FOR_FACTORY2 64 //use Factory backup from Version 1.075
#define FACTORY_BACKUP_YN 64 //Check Backup //Magic : 0x13
#define FACTORY_VALUES 65 //65 ~ 65 + 32
//==============================================================================
// KD8CEC EEPROM MAP

View File

@@ -1,10 +1,7 @@
/*************************************************************************
KD8CEC's uBITX Display Routine for LCD1602 Parrel
1.This is the display code for the default LCD mounted in uBITX.
2.Display related functions of uBITX. Some functions moved from uBITX_Ui.
3.uBITX Idle time Processing
Functions that run at times that do not affect TX, CW, and CAT
It is called in 1/10 time unit.
2.Some functions moved from uBITX_Ui.
-----------------------------------------------------------------------------
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

View File

@@ -1,10 +1,7 @@
/*************************************************************************
KD8CEC's uBITX Display Routine for LCD1602 Dual LCD by KD8CEC
1.This is the display code for the default LCD mounted in uBITX.
2.Display related functions of uBITX. Some functions moved from uBITX_Ui.
3.uBITX Idle time Processing
Functions that run at times that do not affect TX, CW, and CAT
It is called in 1/10 time unit.
KD8CEC's uBITX Display Routine for LCD1602 Dual LCD
1.This is the display code for the 16x02 Dual LCD
2.Some functions moved from uBITX_Ui.
-----------------------------------------------------------------------------
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

View File

@@ -1,10 +1,7 @@
/*************************************************************************
KD8CEC's uBITX Display Routine for LCD2004 Parrel
1.This is the display code for the default LCD mounted in uBITX.
2.Display related functions of uBITX. Some functions moved from uBITX_Ui.
3.uBITX Idle time Processing
Functions that run at times that do not affect TX, CW, and CAT
It is called in 1/10 time unit.
KD8CEC's uBITX Display Routine for LCD2004 Parrel & I2C
1.This is the display code for the 20x04 LCD
2.Some functions moved from uBITX_Ui.
-----------------------------------------------------------------------------
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

View File

@@ -271,8 +271,10 @@ void menuCHMemory(int btn, byte isMemoryToVfo){
if (isMemoryToVfo == 1)
{
if (resultFreq > 3000 && resultFreq < 60000000)
setFrequency(resultFreq);
byteToMode(loadMode, 1);
{
byteToMode(loadMode, 1);
setFrequency(resultFreq);
}
}
else
{
@@ -1106,7 +1108,6 @@ void menuSetupKeyType(int btn){
}
*/
printLineF2(F("CW Key Type set!"));
cwKeyType = selectedKeyType;
EEPROM.put(CW_KEY_TYPE, cwKeyType);
@@ -1127,7 +1128,7 @@ void menuSetupKeyType(int btn){
}
//=====================================================
//END OF STANDARD Tune Setup for reduce Program Memory
//END OF STANDARD Set by Knob for reduce Program Memory
//=====================================================

View File

@@ -199,7 +199,7 @@ int getBtnStatus(void){
readButtonValue = readButtonValue / 4;
//return FKEY_VFOCHANGE;
for (int i = 0; i < 16; i++)
if (KeyValues[i][0] <= readButtonValue && KeyValues[i][1] >= readButtonValue)
if (KeyValues[i][2] != 0 && KeyValues[i][0] <= readButtonValue && KeyValues[i][1] >= readButtonValue)
return KeyValues[i][2];
//return i;
}