Merge pull request #2 from phdlee/control-bug-fix

Control bug fix
This commit is contained in:
phdlee 2018-01-01 16:04:03 +09:00 committed by GitHub
commit 04c12af0cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 31 deletions

View File

@ -1,4 +1,23 @@
#uBITX
uBITX firmware, written for the Raduino/Arduino control of uBITX transceivers
This project is based on https://github.com/afarhan/ubitx and all copyright is inherited.
The copyright information of the original is below.
KD8CEC
----------------------------------------------------------------------------
## REVISION RECORD
0.21
- fixed the cw side tone configuration.
- Fix the error that the frequency is over.
- fixed frequency display (alignment, point)
0.20
- original uBITX software (Ashhar Farhan)
## Original README.md
uBITX firmware, written for the Raduino/Arduino control of uBITX transceigers
Copyright (C) 2017, Ashhar Farhan

View File

@ -168,6 +168,10 @@ int count = 0; //to generally count ticks, loops, etc
#define LOWEST_FREQ (3000000l)
#define HIGHEST_FREQ (30000000l)
//When the frequency is moved by the dial, the maximum value by KD8CEC
#define LOWEST_FREQ_DIAL (3000l)
#define HIGHEST_FREQ_DIAL (60000000l)
//we directly generate the CW by programmin the Si5351 to the cw tx frequency, hence, both are different modes
//these are the parameter passed to startTx
#define TX_SSB 0
@ -391,31 +395,39 @@ void checkButton(){
void doTuning(){
int s;
unsigned long prev_freq;
int incdecValue = 0;
s = enc_read();
if (s){
prev_freq = frequency;
if (s > 10)
frequency += 200000l;
incdecValue = 200000l;
if (s > 7)
frequency += 10000l;
incdecValue = 10000l;
else if (s > 4)
frequency += 1000l;
incdecValue = 1000l;
else if (s > 2)
frequency += 500;
incdecValue = 500;
else if (s > 0)
frequency += 50l;
incdecValue = 50l;
else if (s > -2)
frequency -= 50l;
incdecValue = -50l;
else if (s > -4)
frequency -= 500l;
incdecValue = -500l;
else if (s > -7)
frequency -= 1000l;
incdecValue = -1000l;
else if (s > -9)
frequency -= 10000l;
incdecValue = -10000l;
else
frequency -= 200000l;
incdecValue = -200000l;
if (incdecValue > 0 && frequency + incdecValue > HIGHEST_FREQ_DIAL)
frequency = HIGHEST_FREQ_DIAL;
else if (incdecValue < 0 && frequency < -incdecValue + LOWEST_FREQ_DIAL) //for compute and compare based integer type.
frequency = LOWEST_FREQ_DIAL;
else
frequency += incdecValue;
if (prev_freq < 10000000l && frequency > 10000000l)
isUSB = true;

View File

@ -246,6 +246,7 @@ int menuCWSpeed(int btn){
delay(2000);
}
printLine2("");
updateDisplay();
menuOn = 0;
}

View File

@ -100,11 +100,12 @@ void printLine2(char *c){
void updateDisplay() {
// tks Jack Purdum W8TEE
// replaced fsprint commmands by str commands for code size reduction
// replace code for Frequency numbering error (alignment, point...) by KD8CEC
int i;
unsigned long tmpFreq = frequency; //
memset(c, 0, sizeof(c));
memset(b, 0, sizeof(b));
ultoa(frequency, b, DEC);
if (inTx){
if (cwTimeout > 0)
@ -127,23 +128,17 @@ void updateDisplay() {
strcat(c, "B:");
}
//one mhz digit if less than 10 M, two digits if more
if (frequency < 10000000l){
c[6] = ' ';
c[7] = b[0];
strcat(c, ".");
strncat(c, &b[1], 3);
strcat(c, ".");
strncat(c, &b[4], 3);
}
else {
strncat(c, b, 2);
strcat(c, ".");
strncat(c, &b[2], 3);
strcat(c, ".");
strncat(c, &b[5], 3);
//display frequency
for (int i = 15; i >= 6; i--) {
if (tmpFreq > 0) {
if (i == 12 || i == 8) c[i] = '.';
else {
c[i] = tmpFreq % 10 + 0x30;
tmpFreq /= 10;
}
}
else
c[i] = ' ';
}
if (inTx)