Do some stuff
All checks were successful
Build Firmware / build (push) Successful in 27s

This commit is contained in:
2025-03-10 21:48:58 +01:00
parent 8dd68d74a6
commit 4fe99744e1
9 changed files with 71 additions and 6 deletions

View File

@@ -42,6 +42,8 @@
#include "settings.h" #include "settings.h"
#include "ui/inputbox.h" #include "ui/inputbox.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "driver/st7565.h"
#ifdef ENABLE_REGA #ifdef ENABLE_REGA
#include "app/rega.h" #include "app/rega.h"
#endif #endif
@@ -58,6 +60,11 @@ static void ACTION_Scan_FM(bool bRestart);
static void ACTION_AlarmOr1750(bool b1750); static void ACTION_AlarmOr1750(bool b1750);
inline static void ACTION_Alarm() { ACTION_AlarmOr1750(false); } inline static void ACTION_Alarm() { ACTION_AlarmOr1750(false); }
inline static void ACTION_1750() { ACTION_AlarmOr1750(true); }; inline static void ACTION_1750() { ACTION_AlarmOr1750(true); };
inline static void ACTION_SSTV() {
gFlagPrepareTX = gAlarmState != ALARM_STATE_OFF;
gAlarmState = ALARM_STATE_SSTV;
};
#endif #endif
inline static void ACTION_ScanRestart() { ACTION_Scan(true); }; inline static void ACTION_ScanRestart() { ACTION_Scan(true); };
@@ -102,6 +109,8 @@ void (*action_opt_table[])(void) = {
[ACTION_OPT_1750] = &FUNCTION_NOP, [ACTION_OPT_1750] = &FUNCTION_NOP,
#endif #endif
[ACTION_REQ_SSTV] = &ACTION_SSTV,
#ifdef ENABLE_BLMIN_TMP_OFF #ifdef ENABLE_BLMIN_TMP_OFF
[ACTION_OPT_BLMIN_TMP_OFF] = &ACTION_BlminTmpOff, [ACTION_OPT_BLMIN_TMP_OFF] = &ACTION_BlminTmpOff,
#else #else

View File

@@ -1395,9 +1395,9 @@ void APP_TimeSlice10ms(void) {
SCANNER_TimeSlice10ms(); SCANNER_TimeSlice10ms();
if (gEnteringSMS == SMS_NOT_ENTERING) { // if (gEnteringSMS == SMS_NOT_ENTERING) {
MSG_FSKReceiveData(); // MSG_FSKReceiveData();
} // }
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) { if (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState == AIRCOPY_TRANSFER && gAirCopyIsSendMode == 1) {

View File

@@ -977,7 +977,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
MSG_FSKSendData(&dataPacket); MSG_FSKSendData(&dataPacket);
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false); BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
MSG_EnableRX(true); //MSG_EnableRX(true);
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
dataPTR = dataPacket.data; dataPTR = dataPacket.data;
memset(dataPacket.data, 0, DataPacketDataSize); memset(dataPacket.data, 0, DataPacketDataSize);

View File

@@ -42,7 +42,7 @@ static uint16_t gBK4819_GpioOutState;
bool gRxIdleMode; bool gRxIdleMode;
__inline uint16_t scale_freq(const uint16_t freq) __inline uint16_t scale_freq(uint16_t freq)
{ {
// return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding // return (((uint32_t)freq * 1032444u) + 50000u) / 100000u; // with rounding
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding

View File

@@ -65,6 +65,8 @@ typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
// radio is asleep, not listening // radio is asleep, not listening
extern bool gRxIdleMode; extern bool gRxIdleMode;
uint16_t scale_freq(uint16_t freq);
void BK4819_Init(void); void BK4819_Init(void);
uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register); uint16_t BK4819_ReadRegister(BK4819_REGISTER_t Register);
void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data); void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);

View File

@@ -48,6 +48,7 @@
#include "ui/status.h" #include "ui/status.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "app/app.h" #include "app/app.h"
#include "driver/systick.h"
FUNCTION_Type_t gCurrentFunction; FUNCTION_Type_t gCurrentFunction;
@@ -150,6 +151,52 @@ void FUNCTION_PowerSave() {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
#define SSTV_MULT 1
#define SCALE_FREQ(freq) ((((uint32_t)(freq) * 1353245u) + (1u << 16)) >> 17)
void BK4819_PlaySSTV_Robot8() {
BK4819_EnterTxMute();
BK4819_SetAF(gEeprom.DTMF_SIDE_TONE);
BK4819_TransmitTone(true, 1000);
SYSTEM_DelayMs(100);
BK4819_WriteRegister(BK4819_REG_70,
BK4819_REG_70_MASK_ENABLE_TONE1 | (66u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_EnableTXLink();
SYSTEM_DelayMs(50);
// **Send 9x Vertical Sync Pulses (1,900 Hz, 50ms each)**
// **Send 3x Vertical Sync Pulses (1,900 Hz, 30ms each)**
for (int i = 0; i < 3; i++) {
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(1900));
SYSTEM_DelayMs(30);
}
// **Transmit Image Data**
for (uint8_t y = 0; y < 8; y++) {
for (uint8_t rep = 0; rep < 2; rep++) {
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(1200));
SYSTEM_DelayMs(5);
for (uint8_t bit = 0; bit < 8; bit++) {
for (uint8_t x = 0; x < 128; x++) {
uint8_t byte = gFrameBuffer[y][x];
uint8_t bitV = byte & (1 << bit);
uint16_t freq = (bitV) ? 2300 : 1200;
BK4819_WriteRegister(BK4819_REG_71, SCALE_FREQ(freq));
SYSTICK_DelayUs(432); // Pixel time = ~0.432ms
}
}
}
}
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
// **End Transmission: Mute Transmitter**
BK4819_ExitTxMute();
}
void FUNCTION_Transmit() { void FUNCTION_Transmit() {
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11 // if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
@@ -216,6 +263,10 @@ void FUNCTION_Transmit() {
} }
#endif #endif
if (gAlarmState == ALARM_STATE_SSTV) {
BK4819_PlaySSTV_Robot8();
gAlarmState = ALARM_STATE_OFF;
}
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_TXALARM) if (gAlarmState == ALARM_STATE_TXALARM)
BK4819_TransmitTone(true, 500); BK4819_TransmitTone(true, 500);

3
misc.h
View File

@@ -61,7 +61,8 @@ enum AlarmState_t {
ALARM_STATE_OFF = 0, ALARM_STATE_OFF = 0,
ALARM_STATE_TXALARM, ALARM_STATE_TXALARM,
ALARM_STATE_SITE_ALARM, ALARM_STATE_SITE_ALARM,
ALARM_STATE_TX1750 ALARM_STATE_TX1750,
ALARM_STATE_SSTV
}; };
typedef enum AlarmState_t AlarmState_t; typedef enum AlarmState_t AlarmState_t;

View File

@@ -139,6 +139,7 @@ enum ACTION_OPT_t {
ACTION_OPT_REGA_ALARM, ACTION_OPT_REGA_ALARM,
ACTION_OPT_REGA_TEST, ACTION_OPT_REGA_TEST,
#endif #endif
ACTION_REQ_SSTV,
ACTION_OPT_LEN ACTION_OPT_LEN
}; };

View File

@@ -398,6 +398,7 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET}, {"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
#endif #endif
#endif #endif
{"SSTV", ACTION_REQ_SSTV},
}; };
const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(gSubMenu_SIDEFUNCTIONS); const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(gSubMenu_SIDEFUNCTIONS);