Did add some code for updating the RigState architecture. Not ready to swap it out yet, however.

This commit is contained in:
Rob French
2021-02-11 22:00:24 -06:00
parent c3cc9a7cf7
commit 814fe6c733
5 changed files with 196 additions and 16 deletions

View File

@@ -350,3 +350,41 @@ void doRaduinoToTeensy(UBitxRigState* r) {
Serial.print(len);
Serial.println();
}
void updateStateFromRaduino(UBitxRigState& r) {
// Note, we really need to be checking a dirty flag for this. But, I don't have a dirty flag in this version of the data type...
if (vfoActive == VFO_A) {
rigState.vfo[0] = frequency;
rigState.flags &= ~UBITX_VFOB_FLAG;
} else if (vfoActive == VFO_B) {
rigState.vfo[1] = frequency;
rigState.flags |= UBITX_VFOB_FLAG;
}
rigState.rit = ritRxFrequency - frequency;
rigState.flags = 0;
rigState.flags |= (vfoActive == VFO_B ? UBITX_VFOB_FLAG : 0);
rigState.flags |= (cwMode != 0 ? UBITX_CW_FLAG : 0);
rigState.flags |= (isUSB != 0 ? UBITX_USB_FLAG : 0);
rigState.flags |= (splitOn != 0 ? UBITX_SPLIT_FLAG : 0);
rigState.flags |= (ritOn != 0 ? UBITX_RIT_FLAG : 0);
}
void updateRaduinoFromState(UBitxRigState& r) {
vfoActive = rigState.flags & UBITX_VFOB_FLAG ? VFO_B : VFO_A;
if (vfoActive == VFO_A) {
if (rigState.vfo[0] != frequency) {
setFrequency(rigState.vfo[0]);
} else if (vfoActive == VFO_B) {
setFrequency(rigState.vfo[1]);
}
}
ritRxFrequency = frequency + rigState.rit;
splitOn = rigState.flags & UBITX_SPLIT_FLAG ? 1 : 0;
ritOn = rigState.flags & UBITX_RIT_FLAG ? 1 : 0;
isUSB = rigState.flags & UBITX_USB_FLAG ? 1 : 0;
if (rigState.flags & UBITX_CW_FLAG) {
cwMode = isUSB ? 2 : 1; // 2 = cwu / 1 = cwl
} else {
cwMode = 0;
}
}