Fix up FSK
All checks were successful
Build Firmware / build (push) Successful in 25s

This commit is contained in:
2025-04-01 17:40:08 +02:00
parent 7b1d31fdef
commit c0d3ba51a2
4 changed files with 227 additions and 211 deletions

View File

@@ -38,20 +38,26 @@ void MESSAGES_SAVE() {
Data[1]++;
EEPROM_WriteBuffer(SEQParameterEEPROM, Data);
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 0,
(uint8_t * ) & inBoundPacket + 4); // metadata
(uint8_t *) &inBoundPacket + 4); // metadata
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 8,
(uint8_t * ) & inBoundPacket + 12); // message part 1
(uint8_t *) &inBoundPacket + 12); // message part 1
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 16,
(uint8_t * ) & inBoundPacket + 20); // message part 2
(uint8_t *) &inBoundPacket + 20); // message part 2
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 24,
(uint8_t * ) & inBoundPacket + 28); // message part 3
(uint8_t *) &inBoundPacket + 28); // message part 3
EEPROM_WriteBuffer(MESSAGES_START + (msgIndex * sizeof(StoredPacket)) + 32,
(uint8_t * ) & inBoundPacket + 36); // message part 4
(uint8_t *) &inBoundPacket + 36); // message part 4
}
void MESSAGES_GET() {
EEPROM_ReadBuffer(MESSAGES_START + (gActiveMessage * sizeof(StoredPacket)), &loadedPacket, sizeof(StoredPacket));
if (gActiveMessage == MESSAGES_COUNT) {
memcpy(&loadedPacket, (uint8_t *) &dataPacket + (sizeof(DataPacket) - sizeof(StoredPacket)),
sizeof(StoredPacket));
} else {
EEPROM_ReadBuffer(MESSAGES_START + (gActiveMessage * sizeof(StoredPacket)), &loadedPacket,
sizeof(StoredPacket));
}
}
void MESSAGES_DELETE() {
@@ -121,21 +127,7 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
} else if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
if (bKeyPressed) {
if (strlen((char *) dataPacket.data)) {
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
: gEeprom.TX_VFO;
if (VfoState[vfo] == VFO_STATE_NORMAL &&
!TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
RADIO_PrepareTX();
BK4819_SetScramble(gCurrentVfo->SCRAMBLING_TYPE);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
MSG_FSKSendData(&dataPacket);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
MSG_EnableRX(true);
gVfoConfigureMode = VFO_CONFIGURE;
dataPTR = dataPacket.data;
memset(dataPacket.data, 0, DataPacketDataSize);
}
MSG_FSKSendData(&dataPacket);
gEnteringSMS = SMS_NOT_ENTERING;
}
}
@@ -145,7 +137,7 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
case KEY_UP:
if (bKeyPressed) {
gActiveMessage++;
if (gActiveMessage >= MESSAGES_COUNT) {
if (gActiveMessage > MESSAGES_COUNT) {
gActiveMessage = 0;
}
MESSAGES_GET();
@@ -154,7 +146,7 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
case KEY_DOWN:
if (bKeyPressed) {
gActiveMessage--;
if (gActiveMessage >= MESSAGES_COUNT) {
if (gActiveMessage > MESSAGES_COUNT) {
gActiveMessage = MESSAGES_COUNT - 1;
}
MESSAGES_GET();