bug fix 0.26

This commit is contained in:
phdlee 2018-01-13 16:19:23 +09:00
parent b2d3e3a6f8
commit b9b8f4b46f
2 changed files with 102 additions and 20 deletions

View File

@ -154,6 +154,7 @@ int count = 0; //to generally count ticks, loops, etc
#define HAM_BAND_FREQS 302 //40, 1 BAND = 4Byte most bit is mode
//Check Firmware type and version
#define FIRMWAR_ID_ADDR 776 //776 : 0x59, 777 :0x58, 778 : 0x68 : Id Number, if not found id, erase eeprom(32~1023) for prevent system error.
#define VERSION_ADDRESS 779 //check Firmware version
//USER INFORMATION
#define USER_CALLSIGN_KEY 780 //0x59
@ -233,7 +234,8 @@ byte sideToneSub = 0;
//DialLock
byte isDialLock = 0; //000000[0]vfoB [0]vfoA 0Bit : A, 1Bit : B
byte isTxOff = 0;
byte isTxType = 0; //000000[0 - isSplit] [0 - isTXStop]
//Variables for auto cw mode
byte isCWAutoMode = 0; //0 : none, 1 : CW_AutoMode_Menu_Selection, 2 : CW_AutoMode Sending
@ -271,8 +273,8 @@ boolean modeCalibrate = false;//this mode of menus shows extended menus to calib
//Ham Band
#define MAX_LIMIT_RANGE 10 //because limited eeprom size
byte useHamBandCount = 0; //0 use full range frequency
byte tuneTXType = 0; //0 : use full range, 1 : just Change Dial speed, 2 : just ham band change, but can general band by tune, 3 : only ham band
//100 : use full range but not TX on general band, 101 : just change dial speed but.. 2 : jut... but.. 3 : only ham band
byte tuneTXType = 0; //0 : use full range, 1 : just Change Dial speed, 2 : just ham band change, but can general band by tune, 3 : only ham band (just support 0, 2 (0.26 version))
//100 : use full range but not TX on general band, 101 : just change dial speed but.. 2 : jut... but.. 3 : only ham band (just support 100, 102 (0.26 version))
unsigned int hamBandRange[MAX_LIMIT_RANGE][2]; // = //Khz because reduce use memory
//-1 : not found, 0 ~ 9 : Hamband index
@ -454,9 +456,9 @@ void startTx(byte txMode, byte isDisplayUpdate){
return;
}
if (isTxOff != 1)
if ((isTxType & 0x01) != 0x01)
digitalWrite(TX_RX, 1);
inTx = 1;
if (ritOn){
@ -685,6 +687,7 @@ void storeFrequencyAndMode(byte saveType)
void initSettings(){
//read the settings from the eeprom and restore them
//if the readings are off, then set defaults
//for original source Section ===========================
EEPROM.get(MASTER_CAL, calibration);
EEPROM.get(USB_CAL, usbCarrier);
EEPROM.get(VFO_A, vfoA);
@ -692,6 +695,30 @@ void initSettings(){
EEPROM.get(CW_SIDETONE, sideTone);
EEPROM.get(CW_SPEED, cwSpeed);
//for custom source Section =============================
//ID & Version Check from EEProm
//if found different firmware, erase eeprom (32
#define FIRMWAR_ID_ADDR 776 //776 : 0x59, 777 :0x58, 778 : 0x68 : Id Number, if not found id, erase eeprom(32~1023) for prevent system error.
if (EEPROM.read(FIRMWAR_ID_ADDR) != 0x59 ||
EEPROM.read(FIRMWAR_ID_ADDR + 1) != 0x58 ||
EEPROM.read(FIRMWAR_ID_ADDR + 2) != 0x68 ) {
printLineF(1, F("Init EEProm..."));
//initial all eeprom
for (unsigned int i = 32; i < 1024; i++) //protect Master_cal, usb_cal
EEPROM.write(i, 0);
//Write Firmware ID
EEPROM.write(FIRMWAR_ID_ADDR, 0x59);
EEPROM.write(FIRMWAR_ID_ADDR + 1, 0x58);
EEPROM.write(FIRMWAR_ID_ADDR + 2, 0x68);
}
//Version Write for Memory Management Software
if (EEPROM.read(VERSION_ADDRESS) != VERSION_NUM)
EEPROM.write(VERSION_ADDRESS, VERSION_NUM);
//for Save VFO_A_MODE to eeprom
//0: default, 1:not use, 2:LSB, 3:USB, 4:CW, 5:AM, 6:FM
EEPROM.get(VFO_A_MODE, vfoA_mode);
@ -707,10 +734,6 @@ void initSettings(){
if (EEPROM.read(USER_CALLSIGN_KEY) == 0x59)
userCallsignLength = EEPROM.read(USER_CALLSIGN_LEN); //MAXIMUM 18 LENGTH
//Version Write for Memory Management Software
if (EEPROM.read(VERSION_ADDRESS) != VERSION_NUM)
EEPROM.write(VERSION_ADDRESS, VERSION_NUM);
//Ham Band Count
EEPROM.get(HAM_BAND_COUNT, useHamBandCount);
EEPROM.get(TX_TUNE_TYPE, tuneTXType);
@ -808,20 +831,27 @@ void setup()
{
/*
//Init EEProm for Fault EEProm TEST and Factory Reset
//please remove remark for others.
//for (int i = 0; i < 1024; i++)
for (int i = 16; i < 1024; i++) //protect Master_cal, usb_cal
EEPROM.write(i, 0);
EEPROM.write(i, 0xFF);
lcd.begin(16, 2);
printLineF(1, F("Complete Erase"));
sleep(1000);
//while(1);
//end section of test
*/
//Serial.begin(9600);
delay(100);
lcd.begin(16, 2);
//remark for John test
/*
Init_Cat(38400, SERIAL_8N1);
initMeter(); //not used in this build
initSettings();
printLineF(1, F("CECBT v0.25"));
printLineF(1, F("CECBT v0.263"));
if (userCallsignLength > 0 && ((userCallsignLength & 0x80) == 0x80))
{
userCallsignLength = userCallsignLength & 0x7F;
@ -833,9 +863,8 @@ void setup()
delay(500); //< -- replace from delay_background(500, 0) //johns bug report / on raspberry
printLine2("");
}
*/
//replace above to below (before initSettings(); position)
/*
printLine2("CECBT v0.27");
printLine1("uBITX v0.20");
delay(500);
@ -844,6 +873,7 @@ void setup()
Init_Cat(9600, SERIAL_8N1);
initMeter(); //not used in this build
initSettings();
*/
initPorts();
initOscillators();

View File

@ -16,6 +16,7 @@
int menuBand(int btn){
int knob = 0;
int stepChangeCount = 0;
byte btnPressCount = 0;
if (!btn){
printLineF2(F("Band Select?"));
@ -27,6 +28,33 @@ int menuBand(int btn){
while (btnDown()) {
delay(50);
Check_Cat(0); //To prevent disconnections
if (btnPressCount++ > 20) {
btnPressCount = 0;
if (tuneTXType > 0) { //Just toggle 0 <-> 2, if tuneTXType is 100, 100 -> 0 -> 2
tuneTXType = 0;
printLineF2(F("Full range mode"));
}
else {
tuneTXType = 2;
//if empty band Information, auto insert default region 1 frequency range
//This part is made temporary for people who have difficulty setting up, so can remove it when you run out of memory.
useHamBandCount = 10;
hamBandRange[0][0] = 1810; hamBandRange[0][1] = 2000;
hamBandRange[1][0] = 3500; hamBandRange[1][1] = 3800;
hamBandRange[2][0] = 5351; hamBandRange[2][1] = 5367;
hamBandRange[3][0] = 7000; hamBandRange[3][1] = 7200;
hamBandRange[4][0] = 10100; hamBandRange[4][1] = 10150;
hamBandRange[5][0] = 14000; hamBandRange[5][1] = 14350;
hamBandRange[6][0] = 18068; hamBandRange[6][1] = 18168;
hamBandRange[7][0] = 21000; hamBandRange[7][1] = 21450;
hamBandRange[8][0] = 24890; hamBandRange[8][1] = 24990;
hamBandRange[9][0] = 28000; hamBandRange[9][1] = 29700;
printLineF2(F("Ham band mode"));
}
delay_background(1000, 0);
printLine2ClearAndUpdate();
printLineF2(F("Press to confirm"));
}
}
byte currentBandIndex = -1;
@ -213,20 +241,20 @@ void menuSidebandToggle(int btn){
}
}
void menuTxOnOff(int btn){
void menuTxOnOff(int btn, byte optionType){
if (!btn){
if (isTxOff == 0)
if ((isTxType & optionType) == 0)
printLineF2(F("TX OFF?"));
else
printLineF2(F("TX ON?"));
}
else {
if (isTxOff == 0){
isTxOff = 1;
if ((isTxType & optionType) == 0){
isTxType |= optionType;
printLineF2(F("TX OFF!"));
}
else {
isTxOff = 0;
isTxType &= ~(optionType);
printLineF2(F("TX ON!"));
}
delay_background(500, 0);
@ -235,6 +263,30 @@ void menuTxOnOff(int btn){
}
}
/*
void menuSplitOnOff(int btn){
if (!btn){
if ((isTxType & 0x02) == 0)
printLineF2(F("Split OFF?"));
else
printLineF2(F("Split ON?"));
}
else {
if ((isTxType & 0x02) == 0){
isTxType |= 0x02;
printLineF2(F("Split OFF!"));
}
else {
isTxType &= ~(0x02);
printLineF2(F("Split ON!"));
}
delay_background(500, 0);
printLine2ClearAndUpdate();
menuOn = 0;
}
}
*/
/**
* The calibration routines are not normally shown in the menu as they are rarely used
* They can be enabled by choosing this menu option
@ -795,7 +847,7 @@ void doMenu(){
else if (select < 130 && modeCalibrate)
menuSetupTXCWInterval(btnState);
else if (select < 140 && modeCalibrate)
menuTxOnOff(btnState);
menuTxOnOff(btnState, 0x01); //TX OFF / ON
else if (select < 150 && modeCalibrate)
menuExit(btnState);