diff --git a/ubitx_20/ubitx_idle.ino b/ubitx_20/ubitx_idle.ino index 87aa25e..4b72950 100644 --- a/ubitx_20/ubitx_idle.ino +++ b/ubitx_20/ubitx_idle.ino @@ -24,50 +24,18 @@ char line2Buffer[16]; int freqScrollPosition = 0; //Example Line2 Optinal Display //immediate execution, not call by scheulder -void updateLine2Buffer(char isDirectCall) +void updateLine2Buffer(char displayType) { unsigned long tmpFreq = 0; - if (isDirectCall == 0) + if (ritOn) { - if (ritOn) - { - strcpy(line2Buffer, "RitTX:"); - - //display frequency - tmpFreq = ritTxFrequency; - for (int i = 15; i >= 6; i--) { - if (tmpFreq > 0) { - if (i == 12 || i == 8) line2Buffer[i] = '.'; - else { - line2Buffer[i] = tmpFreq % 10 + 0x30; - tmpFreq /= 10; - } - } - else - line2Buffer[i] = ' '; - } - - return; - } //end of ritOn display + strcpy(line2Buffer, "RitTX:"); - //====================================================== - //other VFO display - //====================================================== - if (vfoActive == VFO_B) - { - tmpFreq = vfoA; - } - else - { - tmpFreq = vfoB; - } - - // EXAMPLE 1 & 2 - //U14.150.100 //display frequency - for (int i = 9; i >= 0; i--) { + tmpFreq = ritTxFrequency; + for (int i = 15; i >= 6; i--) { if (tmpFreq > 0) { - if (i == 2 || i == 6) line2Buffer[i] = '.'; + if (i == 12 || i == 8) line2Buffer[i] = '.'; else { line2Buffer[i] = tmpFreq % 10 + 0x30; tmpFreq /= 10; @@ -76,85 +44,101 @@ void updateLine2Buffer(char isDirectCall) else line2Buffer[i] = ' '; } - - //EXAMPLE #1 - if ((displayOption1 & 0x04) == 0x00) //none scroll display - line2Buffer[6] = 'k'; + + return; + } //end of ritOn display + + //====================================================== + //other VFO display + //====================================================== + if (vfoActive == VFO_B) + { + tmpFreq = vfoA; + } + else + { + tmpFreq = vfoB; + } + + // EXAMPLE 1 & 2 + //U14.150.100 + //display frequency + for (int i = 9; i >= 0; i--) { + if (tmpFreq > 0) { + if (i == 2 || i == 6) line2Buffer[i] = '.'; + else { + line2Buffer[i] = tmpFreq % 10 + 0x30; + tmpFreq /= 10; + } + } else + line2Buffer[i] = ' '; + } + + //EXAMPLE #1 + if ((displayOption1 & 0x04) == 0x00) //none scroll display + line2Buffer[6] = 'k'; + else + { + //example #2 + if (freqScrollPosition++ > 18) //none scroll display time { - //example #2 - if (freqScrollPosition++ > 18) //none scroll display time + line2Buffer[6] = 'k'; + if (freqScrollPosition > 25) + freqScrollPosition = -1; + } + else //scroll frequency + { + line2Buffer[10] = 'H'; + line2Buffer[11] = 'z'; + + if (freqScrollPosition < 7) { - line2Buffer[6] = 'k'; - if (freqScrollPosition > 25) - freqScrollPosition = -1; + for (int i = 11; i >= 0; i--) + if (i - (7 - freqScrollPosition) >= 0) + line2Buffer[i] = line2Buffer[i - (7 - freqScrollPosition)]; + else + line2Buffer[i] = ' '; } - else //scroll frequency + else { - line2Buffer[10] = 'H'; - line2Buffer[11] = 'z'; - - if (freqScrollPosition < 7) - { - for (int i = 11; i >= 0; i--) - if (i - (7 - freqScrollPosition) >= 0) - line2Buffer[i] = line2Buffer[i - (7 - freqScrollPosition)]; - else - line2Buffer[i] = ' '; - } - else - { - for (int i = 0; i < 11; i++) - if (i + (freqScrollPosition - 7) <= 11) - line2Buffer[i] = line2Buffer[i + (freqScrollPosition - 7)]; - else - line2Buffer[i] = ' '; - } + for (int i = 0; i < 11; i++) + if (i + (freqScrollPosition - 7) <= 11) + line2Buffer[i] = line2Buffer[i + (freqScrollPosition - 7)]; + else + line2Buffer[i] = ' '; } - } //scroll - - line2Buffer[7] = ' '; - } //check direct call by encoder + } + } //scroll + + line2Buffer[7] = ' '; if (isIFShift) { - if (isDirectCall == 1) - for (int i = 0; i < 16; i++) - line2Buffer[i] = ' '; +// if (isDirectCall == 1) +// for (int i = 0; i < 16; i++) +// line2Buffer[i] = ' '; //IFShift Offset Value line2Buffer[8] = 'I'; line2Buffer[9] = 'F'; - //if (ifShiftValue == 0) - //{ - /* - line2Buffer[10] = 'S'; - line2Buffer[11] = ':'; - line2Buffer[12] = 'O'; - line2Buffer[13] = 'F'; - line2Buffer[14] = 'F'; - */ - //} - //else - //{ - line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0; - line2Buffer[11] = 0; - line2Buffer[12] = ' '; + line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0; + line2Buffer[11] = 0; + line2Buffer[12] = ' '; + + //11, 12, 13, 14, 15 + memset(b, 0, sizeof(b)); + ltoa(ifShiftValue, b, DEC); + strncat(line2Buffer, b, 5); - //11, 12, 13, 14, 15 - 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); + //if (isDirectCall == 1) //if call by encoder (not scheduler), immediate print value + printLine2(line2Buffer); } // end of display IF - else // step display + else // step & Key Type display { - if (isDirectCall != 0) - return; + //if (isDirectCall != 0) + // return; memset(&line2Buffer[8], ' ', 8); //Step @@ -174,8 +158,6 @@ void updateLine2Buffer(char isDirectCall) else line2Buffer[i +isStepKhz] = ' '; } - //if (isStepKhz == 1) - // line2Buffer[10] = 'k'; if (isStepKhz == 0) { @@ -184,7 +166,7 @@ void updateLine2Buffer(char isDirectCall) } line2Buffer[13] = ' '; - //if ( + //Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb if (cwKeyType == 0) { @@ -202,7 +184,6 @@ void updateLine2Buffer(char isDirectCall) line2Buffer[15] = 'B'; } } - } //meterType : 0 = S.Meter, 1 : P.Meter diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 02486c4..5d82b51 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -557,6 +557,13 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob int negativeSensitivity; char isInitDisplay = 1; delay_background(300, 0); //Default Delay + + if (valueType < 3) + { + strcpy(b, "Press, set "); + strcat(b, displayTitle); + printLine1(b); + } while(!btnDown()) { @@ -607,6 +614,7 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob */ else { + strcat(b, ":"); itoa(targetValue,c, 10); strcat(b, c); } @@ -646,14 +654,14 @@ void menuCWSpeed(int btn){ return; } - printLineF1(F("Press to set WPM")); + //printLineF1(F("Press to set WPM")); //strcpy(b, "WPM:"); //itoa(wpm,c, 10); //strcat(b, c); //printLine2(b); //delay_background(300, 0); - wpm = getValueByKnob(0, wpm, 3, 50, 1, "WPM:", 3); + wpm = getValueByKnob(0, wpm, 3, 50, 1, "WPM", 3); /* while(!btnDown()){ @@ -694,13 +702,13 @@ void menuSetupCwTone(int btn){ } prev_sideTone = sideTone; - printLineF1(F("Tune CW tone")); + //printLineF1(F("Tune CW tone")); //printLineF2(F("PTT to confirm.")); - printLineF1(F("Press to set WPM")); + //printLineF1(F("Press to set WPM")); //delay_background(1000, 0); - tone(CW_TONE, sideTone); + //tone(CW_TONE, sideTone); - sideTone = getValueByKnob(1, sideTone, 100, 2000, 10, "", 2); //1 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize + sideTone = getValueByKnob(1, sideTone, 100, 2000, 10, "Tone", 2); //1 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize /* //disable all clock 1 and clock 2 @@ -750,8 +758,7 @@ void menuSetupCwDelay(int btn){ return; } - printLineF1(F("Press, set Delay")); - + //printLineF1(F("Press, set Delay")); /* strcpy(b, "DELAY:"); itoa(tmpCWDelay,c, 10); @@ -760,7 +767,7 @@ void menuSetupCwDelay(int btn){ */ //delay_background(300, 0); - tmpCWDelay = getValueByKnob(0, tmpCWDelay, 3, 2500, 10, "DELAY:", 2); //0 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize + tmpCWDelay = getValueByKnob(0, tmpCWDelay, 3, 2500, 10, "Delay", 2); //0 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize /* while(!btnDown()){ @@ -802,10 +809,10 @@ void menuSetupTXCWInterval(int btn){ return; } - printLineF1(F("Press, set Delay")); + //printLineF1(F("Press, set Delay")); //delay_background(300, 0); - tmpTXCWInterval = getValueByKnob(0, tmpTXCWInterval, 0, 500, 2, "Start Delay:", 2); //0 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize + tmpTXCWInterval = getValueByKnob(0, tmpTXCWInterval, 0, 500, 2, "Delay", 2); //0 : Generate Tone, targetValue, minKnobValue, maxKnobValue, stepSize /* while(!btnDown()){ @@ -863,7 +870,7 @@ void menuIFSSetup(int btn){ //updateLine2Buffer(1); //setFrequency(frequency); - ifShiftValue = getValueByKnob(2, ifShiftValue, -20000, 20000, 50, "IFS:", 2); //2 : IF Setup (updateLine2Buffer(1), SetFrequency), targetValue, minKnobValue, maxKnobValue, stepSize + ifShiftValue = getValueByKnob(2, ifShiftValue, -20000, 20000, 50, "IFS", 2); //2 : IF Setup (updateLine2Buffer(1), SetFrequency), targetValue, minKnobValue, maxKnobValue, stepSize /* //Off or Change Value