feat: Strlen from fw, turn on green led on squelch open

pull/70/head
Mikhail Yudin 2023-08-13 14:46:53 +07:00
rodzic b56c2eb68a
commit 487b281779
4 zmienionych plików z 10 dodań i 12 usunięć

Wyświetl plik

@ -43,6 +43,9 @@ BK4819Reset = 0xa7cc + 1;
.globl IntDivide .globl IntDivide
IntDivide = 0x128 + 1; IntDivide = 0x128 + 1;
.globl Strlen
Strlen = 0x1c0 + 1;
.globl BK4819SetChannelBandwidth .globl BK4819SetChannelBandwidth
BK4819SetChannelBandwidth = 0xaa48 + 1; BK4819SetChannelBandwidth = 0xaa48 + 1;

Wyświetl plik

@ -23,6 +23,7 @@ extern "C" {
void AirCopyFskSetup(); void AirCopyFskSetup();
void BK4819Reset(); void BK4819Reset();
int IntDivide(int s32Divident, int s32Divisor); int IntDivide(int s32Divident, int s32Divisor);
int Strlen(const char *string);
void BK4819SetChannelBandwidth(bool narrow); void BK4819SetChannelBandwidth(bool narrow);
void BK4819WriteFrequency(unsigned int u32Frequency); void BK4819WriteFrequency(unsigned int u32Frequency);
void BK4819SetPaGain(unsigned short u16PaBias, unsigned int u32Frequency); void BK4819SetPaGain(unsigned short u16PaBias, unsigned int u32Frequency);

Wyświetl plik

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <string.h> #include <string.h>
#include <type_traits> #include <type_traits>
#include "system.hpp"
struct ILcd { struct ILcd {
virtual void UpdateScreen() = 0; virtual void UpdateScreen() = 0;
@ -161,7 +162,7 @@ public:
} }
void Print(const char *C8String) const { void Print(const char *C8String) const {
for (unsigned char i = 0; i < strlen(C8String); i++) { for (unsigned char i = 0; i < Strlen(C8String); i++) {
PrintCharacter(C8String[i]); PrintCharacter(C8String[i]);
} }
} }
@ -260,7 +261,7 @@ public:
startIdx = 9 - u8DigsToCut - u8FixedDigtsCnt; startIdx = 9 - u8DigsToCut - u8FixedDigtsCnt;
const char *str = U8NumBuff + startIdx; const char *str = U8NumBuff + startIdx;
const char len = strlen(str); const char len = Strlen(str);
const char dot[1] = {64}; const char dot[1] = {64};
for (unsigned char i = 0; i < len; i++) { for (unsigned char i = 0; i < len; i++) {
if (pointAt == len - i) { if (pointAt == len - i) {

Wyświetl plik

@ -214,11 +214,11 @@ public:
void Update() { void Update() {
if (peakRssi >= rssiTriggerLevel) { if (peakRssi >= rssiTriggerLevel) {
// ToggleGreen(true); ToggleGreen(true);
Listen(); Listen();
} }
if (peakRssi < rssiTriggerLevel) { if (peakRssi < rssiTriggerLevel) {
// ToggleGreen(false); ToggleGreen(false);
Scan(); Scan();
} }
} }
@ -288,14 +288,7 @@ private:
void ResetPeak() { peakRssi = 0; } void ResetPeak() { peakRssi = 0; }
void SetBW() { void SetBW() { BK4819SetChannelBandwidth(mode < 3); }
/* auto Reg = BK4819Read(0x43);
Reg &= ~(0b11 << 4);
if (mode >= 3)
Reg |= 0b10 << 4;
BK4819Write(0x43, Reg); */
BK4819SetChannelBandwidth(mode < 3);
}
void MuteAF() { BK4819Write(0x47, 0); } void MuteAF() { BK4819Write(0x47, 0); }
void RestoreOldAFSettings() { BK4819Write(0x47, oldAFSettings); } void RestoreOldAFSettings() { BK4819Write(0x47, oldAFSettings); }