complete setup menu ui for reduce program memory

This commit is contained in:
phdlee 2018-04-05 17:36:16 +09:00
parent 02f22d66e5
commit e8d6792073
2 changed files with 104 additions and 116 deletions

View File

@ -24,50 +24,18 @@ char line2Buffer[16];
int freqScrollPosition = 0; int freqScrollPosition = 0;
//Example Line2 Optinal Display //Example Line2 Optinal Display
//immediate execution, not call by scheulder //immediate execution, not call by scheulder
void updateLine2Buffer(char isDirectCall) void updateLine2Buffer(char displayType)
{ {
unsigned long tmpFreq = 0; unsigned long tmpFreq = 0;
if (isDirectCall == 0) if (ritOn)
{ {
if (ritOn) strcpy(line2Buffer, "RitTX:");
{
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
//======================================================
//other VFO display
//======================================================
if (vfoActive == VFO_B)
{
tmpFreq = vfoA;
}
else
{
tmpFreq = vfoB;
}
// EXAMPLE 1 & 2
//U14.150.100
//display frequency //display frequency
for (int i = 9; i >= 0; i--) { tmpFreq = ritTxFrequency;
for (int i = 15; i >= 6; i--) {
if (tmpFreq > 0) { if (tmpFreq > 0) {
if (i == 2 || i == 6) line2Buffer[i] = '.'; if (i == 12 || i == 8) line2Buffer[i] = '.';
else { else {
line2Buffer[i] = tmpFreq % 10 + 0x30; line2Buffer[i] = tmpFreq % 10 + 0x30;
tmpFreq /= 10; tmpFreq /= 10;
@ -76,85 +44,101 @@ void updateLine2Buffer(char isDirectCall)
else else
line2Buffer[i] = ' '; line2Buffer[i] = ' ';
} }
//EXAMPLE #1 return;
if ((displayOption1 & 0x04) == 0x00) //none scroll display } //end of ritOn display
line2Buffer[6] = 'k';
//======================================================
//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 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 line2Buffer[6] = 'k';
if (freqScrollPosition++ > 18) //none scroll display time if (freqScrollPosition > 25)
freqScrollPosition = -1;
}
else //scroll frequency
{
line2Buffer[10] = 'H';
line2Buffer[11] = 'z';
if (freqScrollPosition < 7)
{ {
line2Buffer[6] = 'k'; for (int i = 11; i >= 0; i--)
if (freqScrollPosition > 25) if (i - (7 - freqScrollPosition) >= 0)
freqScrollPosition = -1; line2Buffer[i] = line2Buffer[i - (7 - freqScrollPosition)];
else
line2Buffer[i] = ' ';
} }
else //scroll frequency else
{ {
line2Buffer[10] = 'H'; for (int i = 0; i < 11; i++)
line2Buffer[11] = 'z'; if (i + (freqScrollPosition - 7) <= 11)
line2Buffer[i] = line2Buffer[i + (freqScrollPosition - 7)];
if (freqScrollPosition < 7) else
{ line2Buffer[i] = ' ';
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] = ' ';
}
} }
} //scroll }
} //scroll
line2Buffer[7] = ' ';
} //check direct call by encoder line2Buffer[7] = ' ';
if (isIFShift) if (isIFShift)
{ {
if (isDirectCall == 1) // if (isDirectCall == 1)
for (int i = 0; i < 16; i++) // for (int i = 0; i < 16; i++)
line2Buffer[i] = ' '; // line2Buffer[i] = ' ';
//IFShift Offset Value //IFShift Offset Value
line2Buffer[8] = 'I'; line2Buffer[8] = 'I';
line2Buffer[9] = 'F'; line2Buffer[9] = 'F';
//if (ifShiftValue == 0) line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0;
//{ line2Buffer[11] = 0;
/* line2Buffer[12] = ' ';
line2Buffer[10] = 'S';
line2Buffer[11] = ':'; //11, 12, 13, 14, 15
line2Buffer[12] = 'O'; memset(b, 0, sizeof(b));
line2Buffer[13] = 'F'; ltoa(ifShiftValue, b, DEC);
line2Buffer[14] = 'F'; strncat(line2Buffer, b, 5);
*/
//}
//else
//{
line2Buffer[10] = ifShiftValue >= 0 ? '+' : 0;
line2Buffer[11] = 0;
line2Buffer[12] = ' ';
//11, 12, 13, 14, 15 //if (isDirectCall == 1) //if call by encoder (not scheduler), immediate print value
memset(b, 0, sizeof(b)); printLine2(line2Buffer);
ltoa(ifShiftValue, b, DEC);
strncat(line2Buffer, b, 5);
//}
if (isDirectCall == 1) //if call by encoder (not scheduler), immediate print value
printLine2(line2Buffer);
} // end of display IF } // end of display IF
else // step display else // step & Key Type display
{ {
if (isDirectCall != 0) //if (isDirectCall != 0)
return; // return;
memset(&line2Buffer[8], ' ', 8); memset(&line2Buffer[8], ' ', 8);
//Step //Step
@ -174,8 +158,6 @@ void updateLine2Buffer(char isDirectCall)
else else
line2Buffer[i +isStepKhz] = ' '; line2Buffer[i +isStepKhz] = ' ';
} }
//if (isStepKhz == 1)
// line2Buffer[10] = 'k';
if (isStepKhz == 0) if (isStepKhz == 0)
{ {
@ -184,7 +166,7 @@ void updateLine2Buffer(char isDirectCall)
} }
line2Buffer[13] = ' '; line2Buffer[13] = ' ';
//if (
//Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb //Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb
if (cwKeyType == 0) if (cwKeyType == 0)
{ {
@ -202,7 +184,6 @@ void updateLine2Buffer(char isDirectCall)
line2Buffer[15] = 'B'; line2Buffer[15] = 'B';
} }
} }
} }
//meterType : 0 = S.Meter, 1 : P.Meter //meterType : 0 = S.Meter, 1 : P.Meter

View File

@ -557,6 +557,13 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
int negativeSensitivity; int negativeSensitivity;
char isInitDisplay = 1; char isInitDisplay = 1;
delay_background(300, 0); //Default Delay delay_background(300, 0); //Default Delay
if (valueType < 3)
{
strcpy(b, "Press, set ");
strcat(b, displayTitle);
printLine1(b);
}
while(!btnDown()) while(!btnDown())
{ {
@ -607,6 +614,7 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
*/ */
else else
{ {
strcat(b, ":");
itoa(targetValue,c, 10); itoa(targetValue,c, 10);
strcat(b, c); strcat(b, c);
} }
@ -646,14 +654,14 @@ void menuCWSpeed(int btn){
return; return;
} }
printLineF1(F("Press to set WPM")); //printLineF1(F("Press to set WPM"));
//strcpy(b, "WPM:"); //strcpy(b, "WPM:");
//itoa(wpm,c, 10); //itoa(wpm,c, 10);
//strcat(b, c); //strcat(b, c);
//printLine2(b); //printLine2(b);
//delay_background(300, 0); //delay_background(300, 0);
wpm = getValueByKnob(0, wpm, 3, 50, 1, "WPM:", 3); wpm = getValueByKnob(0, wpm, 3, 50, 1, "WPM", 3);
/* /*
while(!btnDown()){ while(!btnDown()){
@ -694,13 +702,13 @@ void menuSetupCwTone(int btn){
} }
prev_sideTone = sideTone; prev_sideTone = sideTone;
printLineF1(F("Tune CW tone")); //printLineF1(F("Tune CW tone"));
//printLineF2(F("PTT to confirm.")); //printLineF2(F("PTT to confirm."));
printLineF1(F("Press to set WPM")); //printLineF1(F("Press to set WPM"));
//delay_background(1000, 0); //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 //disable all clock 1 and clock 2
@ -750,8 +758,7 @@ void menuSetupCwDelay(int btn){
return; return;
} }
printLineF1(F("Press, set Delay")); //printLineF1(F("Press, set Delay"));
/* /*
strcpy(b, "DELAY:"); strcpy(b, "DELAY:");
itoa(tmpCWDelay,c, 10); itoa(tmpCWDelay,c, 10);
@ -760,7 +767,7 @@ void menuSetupCwDelay(int btn){
*/ */
//delay_background(300, 0); //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()){ while(!btnDown()){
@ -802,10 +809,10 @@ void menuSetupTXCWInterval(int btn){
return; return;
} }
printLineF1(F("Press, set Delay")); //printLineF1(F("Press, set Delay"));
//delay_background(300, 0); //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()){ while(!btnDown()){
@ -863,7 +870,7 @@ void menuIFSSetup(int btn){
//updateLine2Buffer(1); //updateLine2Buffer(1);
//setFrequency(frequency); //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 //Off or Change Value