From bbb23bf817d93509f9ef014f036f4056fe1a9f8c Mon Sep 17 00:00:00 2001 From: phdlee Date: Mon, 22 Jan 2018 21:16:29 +0900 Subject: [PATCH] default set for new users --- ubitx_20/ubitx_20.ino | 14 +++++++------- ubitx_20/ubitx_menu.ino | 23 ++++++++++------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ubitx_20/ubitx_20.ino b/ubitx_20/ubitx_20.ino index 784fb65..a765fdb 100644 --- a/ubitx_20/ubitx_20.ino +++ b/ubitx_20/ubitx_20.ino @@ -237,7 +237,7 @@ byte sideToneSub = 0; byte isDialLock = 0; //000000[0]vfoB [0]vfoA 0Bit : A, 1Bit : B byte isTxType = 0; //000000[0 - isSplit] [0 - isTXStop] byte arTuneStep[5]; -byte tuneStepIndex; +byte tuneStepIndex; //default Value 0, start Offset is 0 because of check new user //Variables for auto cw mode byte isCWAutoMode = 0; //0 : none, 1 : CW_AutoMode_Menu_Selection, 2 : CW_AutoMode Sending @@ -424,10 +424,7 @@ void setTXFilters(unsigned long freq){ */ void setFrequency(unsigned long f){ - //1 digits discarded - //byte arTuneStep[] = {10, 20, 50, 100, 200}; - //byte tuneStepIndex = 2; - f = (f / arTuneStep[tuneStepIndex]) * arTuneStep[tuneStepIndex]; + f = (f / arTuneStep[tuneStepIndex -1]) * arTuneStep[tuneStepIndex -1]; setTXFilters(f); @@ -605,7 +602,7 @@ void doTuning(){ prev_freq = frequency; //incdecValue = tuningStep * s; - frequency += (arTuneStep[tuneStepIndex] * s); + frequency += (arTuneStep[tuneStepIndex -1] * s); if (prev_freq < 10000000l && frequency > 10000000l) isUSB = true; @@ -780,9 +777,12 @@ void initSettings(){ arTuneStep[2] = 50; arTuneStep[3] = 100; arTuneStep[4] = 200; - tuneStepIndex = 2; } + if (tuneStepIndex == 0) //New User + tuneStepIndex = 3; + + if (cwDelayTime < 1 || cwDelayTime > 250) cwDelayTime = 60; diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 52e3ae4..37165d9 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -787,7 +787,7 @@ void doMenu(){ if (isNeedDisplay) { strcpy(b, "Tune Step:"); - itoa(arTuneStep[tuneStepIndex], c, 10); + itoa(arTuneStep[tuneStepIndex -1], c, 10); strcat(b, c); printLine2(b); isNeedDisplay = 0; @@ -799,18 +799,12 @@ void doMenu(){ select += (i > 0 ? 1 : -1); if (select * select >= 25) { //Threshold 5 * 5 = 25 - if (select < 0) - { - if (tuneStepIndex == 0) - tuneStepIndex = 4; - else + if (select < 0) { + if (tuneStepIndex > 1) tuneStepIndex--; } - else - { - if (tuneStepIndex == 4) - tuneStepIndex = 0; - else + else { + if (tuneStepIndex < 5) tuneStepIndex++; } select = 0; @@ -841,10 +835,13 @@ void doMenu(){ if (!modeCalibrate && select + i < 80) select += i; } - if (i < 0 && select - i >= 0) + //if (i < 0 && select - i >= 0) + if (i < 0 && select - i >= -10) select += i; //caught ya, i is already -ve here, so you add it - if (select < 10) + if (select < -5) + menuExit(btnState); + else if (select < 10) menuBand(btnState); else if (select < 20) menuRitToggle(btnState);