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

@@ -48,6 +48,7 @@
#include "ui/status.h"
#include "ui/ui.h"
#include "app/app.h"
#include "driver/systick.h"
FUNCTION_Type_t gCurrentFunction;
@@ -150,6 +151,52 @@ void FUNCTION_PowerSave() {
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() {
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
@@ -216,6 +263,10 @@ void FUNCTION_Transmit() {
}
#endif
if (gAlarmState == ALARM_STATE_SSTV) {
BK4819_PlaySSTV_Robot8();
gAlarmState = ALARM_STATE_OFF;
}
#ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_TXALARM)
BK4819_TransmitTone(true, 500);