Skip to content

Commit

Permalink
Merge pull request #23 from phdlee/version1.04
Browse files Browse the repository at this point in the history
Optimized from Version1.03
  • Loading branch information
phdlee authored Mar 5, 2018
2 parents d926b15 + fb2c9d2 commit 9faa8bb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 153 deletions.
19 changes: 9 additions & 10 deletions ubitx_20/ubitx_20.ino
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ void saveBandFreqByIndex(unsigned long f, unsigned long mode, char bandIndex) {
When the delay is used, the program will generate an error because it is not communicating,
so Create a new delay function that can do background processing.
*/

unsigned long delayBeforeTime = 0;
byte delay_background(unsigned delayTime, byte fromType){ //fromType : 4 autoCWKey -> Check Paddle
delayBeforeTime = millis();
Expand Down Expand Up @@ -526,7 +525,6 @@ void setFrequency(unsigned long f){
* put the uBitx in tx mode. It takes care of rit settings, sideband settings
* Note: In cw mode, doesnt key the radio, only puts it in tx mode
*/

void startTx(byte txMode, byte isDisplayUpdate){
//Check Hamband only TX //Not found Hamband index by now frequency
if (tuneTXType >= 100 && getIndexHambanBbyFreq(ritOn ? ritTxFrequency : frequency) == -1) {
Expand Down Expand Up @@ -682,7 +680,7 @@ void checkButton(){
delay(10);
Check_Cat(0);
}
delay(50);//debounce
//delay(50);//debounce
}


Expand All @@ -697,7 +695,7 @@ int encodedSumValue = 0;
unsigned long lastTunetime = 0; //if continous moving, skip threshold processing
byte lastMovedirection = 0; //0 : stop, 1 : cw, 2 : ccw

#define skipThresholdTime 100
//#define skipThresholdTime 70
#define encodeTimeOut 1000

void doTuningWithThresHold(){
Expand Down Expand Up @@ -726,7 +724,9 @@ void doTuningWithThresHold(){
encodedSumValue += (s > 0 ? 1 : -1);

//check threshold and operator actions (hold dial speed = continous moving, skip threshold check)
if ((lastTunetime < millis() - skipThresholdTime) && ((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
//not use continues changing by Threshold
//if ((lastTunetime < (millis() - skipThresholdTime)) && ((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
if (((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
return;

lastTunetime = millis();
Expand All @@ -736,7 +736,8 @@ void doTuningWithThresHold(){

prev_freq = frequency;
//incdecValue = tuningStep * s;
frequency += (arTuneStep[tuneStepIndex -1] * s * (s * s < 10 ? 1 : 3)); //appield weight (s is speed)
//frequency += (arTuneStep[tuneStepIndex -1] * s * (s * s < 10 ? 1 : 3)); //appield weight (s is speed)
frequency += (arTuneStep[tuneStepIndex -1] * s); //appield weight (s is speed) //if want need more increase size, change step size

if (prev_freq < 10000000l && frequency > 10000000l)
isUSB = true;
Expand All @@ -757,16 +758,15 @@ void doRIT(){

if (knob < 0)
frequency -= (arTuneStep[tuneStepIndex -1]); //
//frequency -= 100l;
else if (knob > 0)
frequency += (arTuneStep[tuneStepIndex -1]); //
//frequency += 100;

if (old_freq != frequency){
setFrequency(frequency);
updateDisplay();
}
}

/*
save Frequency and mode to eeprom for Auto Save with protected eeprom cycle, by kd8cec
*/
Expand Down Expand Up @@ -1060,7 +1060,6 @@ void initSettings(){
}

void initPorts(){

analogReference(DEFAULT);

//??
Expand Down Expand Up @@ -1110,7 +1109,7 @@ void setup()

//Serial.begin(9600);
lcd.begin(16, 2);
printLineF(1, F("CECBT v1.03"));
printLineF(1, F("CECBT v1.04"));

Init_Cat(38400, SERIAL_8N1);
initMeter(); //not used in this build
Expand Down
19 changes: 11 additions & 8 deletions ubitx_20/ubitx_idle.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ void updateLine2Buffer(char isDirectCall)
{
if (ritOn)
{
strcpy(line2Buffer, "RitTX:");
/*
line2Buffer[0] = 'R';
line2Buffer[1] = 'i';
line2Buffer[2] = 't';
line2Buffer[3] = 'T';
line2Buffer[4] = 'X';
line2Buffer[5] = ':';
*/

//display frequency
tmpFreq = ritTxFrequency;
Expand All @@ -61,12 +64,10 @@ void updateLine2Buffer(char isDirectCall)
if (vfoActive == VFO_B)
{
tmpFreq = vfoA;
//line2Buffer[0] = 'A';
}
else
{
tmpFreq = vfoB;
//line2Buffer[0] = 'B';
}

// EXAMPLE 1 & 2
Expand Down Expand Up @@ -133,16 +134,18 @@ void updateLine2Buffer(char isDirectCall)
line2Buffer[8] = 'I';
line2Buffer[9] = 'F';

if (ifShiftValue == 0)
{
//if (ifShiftValue == 0)
//{
/*
line2Buffer[10] = 'S';
line2Buffer[11] = ':';
line2Buffer[12] = 'O';
line2Buffer[13] = 'F';
line2Buffer[14] = 'F';
}
else
{
*/
//}
//else
//{
line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0;
line2Buffer[11] = 0;
line2Buffer[12] = ' ';
Expand All @@ -151,7 +154,7 @@ void updateLine2Buffer(char isDirectCall)
memset(b, 0, sizeof(b));
ltoa(ifShiftValue, b, DEC);
strncat(line2Buffer, b, 5);
}
//}

if (isDirectCall == 1) //if call by encoder (not scheduler), immediate print value
printLine2(line2Buffer);
Expand Down
Loading

0 comments on commit 9faa8bb

Please sign in to comment.