Support older standard
All checks were successful
Build Firmware / build (push) Successful in 21s

This commit is contained in:
2025-06-03 23:56:25 +02:00
parent 6d98e23202
commit 23dbad1a53
3 changed files with 29 additions and 22 deletions

View File

@@ -122,25 +122,31 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
memset(dataPacket.data, 0, DataPacketDataSize);
prepareDataPacket();
//dataPacket.flags = 0x80 | (gCurrentVfo->OUTPUT_POWER & 0x07);
if (dataPacket.src == 665) {
if (dataPacket.src == 665 || dataPacket.src == 664) {
const uint32_t id24 = 0xFFFFFF & (dataPacket.dest >> 4);
const uint8_t btn = 0x0F & (dataPacket.dest);
// mask just in case
uint8_t out[5];
if (dataPacket.src == 665) {
const uint32_t id24 = 0xFFFFFF & (dataPacket.dest >> 4);
const uint8_t btn = 0x0F & (dataPacket.dest);
// mask just in case
// uint32_t id24 = 0x00A38C;
// uint8_t btn = 0x04;
uint8_t out[10];
// 3-byte big-endian ID
out[0] = (id24 >> 16) & 0xFF;
out[1] = (id24 >> 8) & 0xFF;
out[2] = (id24 >> 0) & 0xFF;
// 3-byte big-endian ID
out[0] = (id24 >> 16) & 0xFF;
out[1] = (id24 >> 8) & 0xFF;
out[2] = (id24 >> 0) & 0xFF;
// first nibble redundancy copy: 0xBB if btn=0xB
out[3] = (btn << 4) | 0x04;
// first nibble redundancy copy: 0xBB if btn=0xB
out[3] = (btn << 4) | 0x04;
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
out[4] = ((btn ^ 0x8) << 4);
// second copy with MSB flipped (btn ^ 0x8) in the high nibble
out[4] = ((btn ^ 0x8) << 4);
}
else {
out[0] = (dataPacket.dest >> 8) & 0xFF;
out[1] = dataPacket.dest & 0xFF;
}
BK4819_EnterTxMute();
RADIO_SetTxParameters();
@@ -160,28 +166,28 @@ void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
SYSTEM_DelayMs(20);
for (unsigned int x = 0; x < 24; x++) {
for (unsigned int y = 0; y < sizeof(out); y++) {
for (unsigned int x = 0; x < 15; x++) {
for (unsigned int y = 0; y < (dataPacket.src == 665 ? 5 : 2); y++) {
for (unsigned char i = 7; i < 8; i--) {
if ((out[y] >> i) & 1) {
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
SYSTICK_DelayUs(400 * 3 - 350);
SYSTICK_DelayUs(400 * (dataPacket.src == 665 ? 3 : 2) - 325);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
SYSTICK_DelayUs(400 * 1 - 350);
SYSTICK_DelayUs(400 * 1 - 325);
} else {
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
// datX |= BK4819_REG_30_ENABLE_PA_GAIN;
SYSTICK_DelayUs(400 * 1 - 350);
SYSTICK_DelayUs(400 * 1 - 325);
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
// datX &= ~BK4819_REG_30_ENABLE_PA_GAIN;
SYSTICK_DelayUs(400 * 3 - 350);
SYSTICK_DelayUs(400 * (dataPacket.src == 665 ? 3 : 2) - 325);
}
}
}
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
SYSTEM_DelayMs(3);
SYSTEM_DelayMs((dataPacket.src == 665 ? 3 : 15));
}
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
SYSTEM_DelayMs(100);

View File

@@ -180,8 +180,9 @@ typedef struct PeakInfo
uint16_t i;
} PeakInfo;
#ifdef ENABLE_SPECTRUM
void APP_RunSpectrum(void);
#endif
#endif /* ifndef SPECTRUM_H */
// vim: ft=c