mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-06-13 10:30:46 +00:00
Revise switch to use a single Serial.write, based on switched changes
This commit is contained in:
parent
c6d83beff0
commit
53a39b0699
|
@ -313,21 +313,17 @@ void catReadEEPRom(uint8_t* cat)
|
||||||
}
|
}
|
||||||
|
|
||||||
void processCatCommand(uint8_t* cmd) {
|
void processCatCommand(uint8_t* cmd) {
|
||||||
uint8_t response[FT817_MESSAGE_SIZE];
|
uint8_t response[FT817_MESSAGE_SIZE] = {0};
|
||||||
|
uint8_t response_length = 0;
|
||||||
|
|
||||||
switch(cmd[CMD]){
|
switch(cmd[CMD]){
|
||||||
/* case Ft817Command_e::LockOn:
|
|
||||||
response[0]=0;
|
|
||||||
Serial.write(response, 1);
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case Ft817Command_e::SetFrequency:
|
case Ft817Command_e::SetFrequency:
|
||||||
{
|
{
|
||||||
uint32_t f = readFreq(cmd);
|
uint32_t f = readFreq(cmd);
|
||||||
setFrequency(f);
|
setFrequency(f);
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
response[0]=0;
|
response[0] = 0x00;
|
||||||
Serial.write(response, 1);
|
response_length = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +355,7 @@ void processCatCommand(uint8_t* cmd) {
|
||||||
SetActiveVfoMode(VfoMode_e::VFO_MODE_USB);
|
SetActiveVfoMode(VfoMode_e::VFO_MODE_USB);
|
||||||
}
|
}
|
||||||
response[0] = 0x00;
|
response[0] = 0x00;
|
||||||
Serial.write(response, 1);
|
response_length = 1;
|
||||||
|
|
||||||
setFrequency(GetActiveVfoFreq());//Refresh frequency to get new mode to take effect
|
setFrequency(GetActiveVfoFreq());//Refresh frequency to get new mode to take effect
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -367,14 +363,14 @@ void processCatCommand(uint8_t* cmd) {
|
||||||
|
|
||||||
case Ft817Command_e::PttOn:
|
case Ft817Command_e::PttOn:
|
||||||
if (!globalSettings.txActive) {
|
if (!globalSettings.txActive) {
|
||||||
response[0] = 0;
|
response[0] = 0x00;
|
||||||
globalSettings.txCatActive = true;
|
globalSettings.txCatActive = true;
|
||||||
startTx(globalSettings.tuningMode);
|
startTx(globalSettings.tuningMode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
response[0] = 0xf0;
|
response[0] = 0xF0;
|
||||||
}
|
}
|
||||||
Serial.write(response,1);
|
response_length = 1;
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -383,20 +379,20 @@ void processCatCommand(uint8_t* cmd) {
|
||||||
stopTx();
|
stopTx();
|
||||||
}
|
}
|
||||||
globalSettings.txCatActive = false;
|
globalSettings.txCatActive = false;
|
||||||
response[0] = 0;
|
response[0] = 0x00;
|
||||||
Serial.write(response,1);
|
response_length = 1;
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ft817Command_e::VfoToggle:
|
case Ft817Command_e::VfoToggle:
|
||||||
response[0] = 0;
|
|
||||||
if (Vfo_e::VFO_A == globalSettings.activeVfo){
|
if (Vfo_e::VFO_A == globalSettings.activeVfo){
|
||||||
globalSettings.activeVfo = Vfo_e::VFO_B;
|
globalSettings.activeVfo = Vfo_e::VFO_B;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
globalSettings.activeVfo = Vfo_e::VFO_A;
|
globalSettings.activeVfo = Vfo_e::VFO_A;
|
||||||
}
|
}
|
||||||
Serial.write(response,1);
|
response[0] = 0x00;
|
||||||
|
response_length = 1;
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -413,7 +409,7 @@ void processCatCommand(uint8_t* cmd) {
|
||||||
reply_status.DiscriminatorCenteringOff = 1;
|
reply_status.DiscriminatorCenteringOff = 1;
|
||||||
reply_status.CodeUnmatched = 0;
|
reply_status.CodeUnmatched = 0;
|
||||||
response[0] = *(uint8_t*)&reply_status;
|
response[0] = *(uint8_t*)&reply_status;
|
||||||
Serial.write(response,1);
|
response_length = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ft817Command_e::ReadTxStatus:
|
case Ft817Command_e::ReadTxStatus:
|
||||||
|
@ -427,15 +423,17 @@ void processCatCommand(uint8_t* cmd) {
|
||||||
reply_status.SplitOff = !globalSettings.splitOn;
|
reply_status.SplitOff = !globalSettings.splitOn;
|
||||||
|
|
||||||
response[0] = *(uint8_t*)&reply_status;
|
response[0] = *(uint8_t*)&reply_status;
|
||||||
|
response_length = 1;
|
||||||
Serial.write(response, 1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
response[0] = 0x00;
|
response[0] = 0x00;
|
||||||
Serial.write(response[0]);
|
response_length = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Serial.write(response, response_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCAT(){
|
void checkCAT(){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user