diff --git a/ubitx_20/ubitx_20.ino b/ubitx_20/ubitx_20.ino index 2ce915d..bf4c9c5 100644 --- a/ubitx_20/ubitx_20.ino +++ b/ubitx_20/ubitx_20.ino @@ -755,6 +755,7 @@ void doRIT(){ } } +/* void doIFShift(){ int knob = enc_read(); unsigned long old_freq = frequency; @@ -770,6 +771,7 @@ void doIFShift(){ setFrequency(frequency); } } +*/ /** save Frequency and mode to eeprom @@ -1169,8 +1171,8 @@ void loop(){ if (!inTx){ if (ritOn) doRIT(); - else if (isIFShift) - doIFShift(); + //else if (isIFShift) + // doIFShift(); else doTuningWithThresHold(); diff --git a/ubitx_20/ubitx_idle.ino b/ubitx_20/ubitx_idle.ino index b96e567..2e1c782 100644 --- a/ubitx_20/ubitx_idle.ino +++ b/ubitx_20/ubitx_idle.ino @@ -122,22 +122,34 @@ void updateLine2Buffer(char isDirectCall) if (isIFShift) { + if (isDirectCall == 1) + for (int i = 0; i < 16; i++) + line2Buffer[i] = ' '; + //IFShift Offset Value line2Buffer[8] = 'I'; line2Buffer[9] = 'F'; - - line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0; - line2Buffer[11] = 0; - line2Buffer[12] = ' '; - line2Buffer[13] = ' '; - line2Buffer[14] = ' '; - line2Buffer[15] = ' '; - - //11, 12, 13, 14, 15 - memset(b, 0, sizeof(b)); - ltoa(ifShiftValue, b, DEC); - strncat(line2Buffer, b, 5); + 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] = ' '; + + //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); } diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 06823ca..82b1f7a 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -239,6 +239,7 @@ void menuRitToggle(int btn){ } } +/* void menuIFSToggle(int btn){ if (!btn){ if (isIFShift == 1) @@ -260,6 +261,69 @@ void menuIFSToggle(int btn){ printLine2ClearAndUpdate(); } } +*/ +void menuIFSToggle(int btn){ + int knob = 0; + char needApplyChangeValue = 1; + + if (!btn){ + if (isIFShift == 1) + printLineF2(F("IF Shift Change?")); + else + printLineF2(F("IF Shift:Off, On?")); + } + else { + if (isIFShift == 0){ + printLineF2(F("IF Shift is ON")); + delay_background(500, 0); + isIFShift = 1; + } + + delay_background(500, 0); + updateLine2Buffer(1); + setFrequency(frequency); + + //Off or Change Value + while(!btnDown() && digitalRead(PTT) == HIGH){ + if (needApplyChangeValue ==1) + { + updateLine2Buffer(1); + setFrequency(frequency); + + if (cwMode == 0) + si5351bx_setfreq(0, usbCarrier + (isIFShift ? ifShiftValue : 0)); //set back the carrier oscillator anyway, cw tx switches it off + else + si5351bx_setfreq(0, cwmCarrier + (isIFShift ? ifShiftValue : 0)); //set back the carrier oscillator anyway, cw tx switches it off + + needApplyChangeValue = 0; + } + + knob = enc_read(); + if (knob != 0){ + if (knob < 0) + ifShiftValue -= 1l; + else if (knob > 0) + ifShiftValue += 1; + + needApplyChangeValue = 1; + } + } + + delay_background(500, 0); //for check Long Press function key + + if (btnDown() || digitalRead(PTT) == LOW || ifShiftValue == 0) + { + isIFShift = 0; + printLineF2(F("IF Shift is OFF")); + setFrequency(frequency); + delay_background(500, 0); + } + + menuOn = 0; + //delay_background(500, 0); + printLine2ClearAndUpdate(); + } +} /* @@ -377,9 +441,9 @@ void menuSelectMode(int btn){ } if (cwMode == 0) - si5351bx_setfreq(0, usbCarrier); //set back the carrier oscillator anyway, cw tx switches it off + si5351bx_setfreq(0, usbCarrier + (isIFShift ? ifShiftValue : 0)); //set back the carrier oscillator anyway, cw tx switches it off else - si5351bx_setfreq(0, cwmCarrier); //set back the carrier oscillator anyway, cw tx switches it off + si5351bx_setfreq(0, cwmCarrier + (isIFShift ? ifShiftValue : 0)); //set back the carrier oscillator anyway, cw tx switches it off setFrequency(frequency); delay_background(500, 0);