Skip to content

Commit

Permalink
Fix ACK Roger playing every RX, Fix hasNewMessage only for valid FSK …
Browse files Browse the repository at this point in the history
…txs, pad batt perc to 4 left spaces
  • Loading branch information
LolloDev5123 committed Jan 10, 2024
1 parent 35148a0 commit 8111b16
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 23 deletions.
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/home/lollodev5123/Documents/Quansheng/GitHub/matoz",
"program": "/home/lollodev5123/Documents/Quansheng/GitHub/matoz/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
59 changes: 59 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ TARGET = firmware
#======== STOCK QUANSHENG FERATURES ========#
ENABLE_AIRCOPY := 0
# 3856 bytes
ENABLE_FMRADIO := 1
ENABLE_FMRADIO := 0
# 84 bytes
ENABLE_FLASHLIGHT_SOS := 1
ENABLE_FLASHLIGHT_SOS := 0
ENABLE_UART := 1
ENABLE_UART_CAT := 0
# Bause we can cut more... - 4108 bytes
# 4108 bytes
ENABLE_DTMF_CALLING := 0
# 1750Hz & 1050Hz FN1 FN2 Tones
ENABLE_DTMF_SIDETONES := 1
Expand Down Expand Up @@ -215,7 +215,7 @@ else
RM = rm -f
FixPath = $1
WHERE = which
K5PROG = utils/k5prog/k5prog -F -YYYYY -p /dev/ttyUSB3 -b
K5PROG = utils/k5prog/k5prog -F -YYYYY -p /dev/ttyUSB0 -b
endif


Expand Down
34 changes: 17 additions & 17 deletions app/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,12 @@ void MSG_StorePacket(const uint16_t interrupt_bits)
#endif
gUpdateStatus = true;
gUpdateDisplay = true;

BK4819_DisableDTMF();
RADIO_SetTxParameters();
SYSTEM_DelayMs(500);
BK4819_ExitTxMute();
BK4819_PlayRoger(99);
}
#endif
}
Expand Down Expand Up @@ -702,33 +708,27 @@ void MSG_StorePacket(const uint16_t interrupt_bits)
UART_printf("SMS<%s\r\n", &msgFSKBuffer[2]);
#endif

#ifdef ENABLE_MESSENGER_DELIVERY_NOTIFICATION
BK4819_DisableDTMF();
RADIO_SetTxParameters();
SYSTEM_DelayMs(500);
BK4819_ExitTxMute();
BK4819_PlayRoger(99);
#endif
}

if (gAppToDisplay != APP_MESSENGER)
{
hasNewMessage = true;
gUpdateStatus = true;
gUpdateDisplay = true;
UI_DisplayStatus();
}
else
{

gUpdateDisplay = true;
}

}

gFSKWriteIndex = 0;
// Transmit a message to the sender that we have received the message (Unless it's a service message)
if (msgFSKBuffer[0] == 'M' && msgFSKBuffer[1] == 'S' && msgFSKBuffer[2] != 0x1b)
{
#ifdef ENABLE_MESSENGER_DELIVERY_NOTIFICATION
MSG_Send("\x1b\x1b\x1bRCVD ", true);
#endif
if (rx_finished && gAppToDisplay != APP_MESSENGER)
{
hasNewMessage = true;
gUpdateStatus = true;
gUpdateDisplay = true;
UI_DisplayStatus();
}
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions ui/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,18 @@ void UI_DisplayStatus(void) {

char String[32];
#ifdef ENABLE_STATUS_BATTERY_PERC
sprintf(String, "%s %s %s %s %s %s %s %u%%",
#else
char Perc[4];
char Format[32];
sprintf(Perc, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
if (strlen(Perc) == 3) {
strcpy(Format, "%s %s %s %s %s %s %s %u%%"); //7s +1 "_00%"
} else if (strlen(Perc) == 2) {
strcpy(Format, "%s %s %s %s %s %s %s %u%%"); //8s +2 "__0%"
} else {
strcpy(Format, "%s %s %s %s %s %s %s %u%%"); //6s "000%"
}
sprintf(String, Format,
#else
sprintf(String, "%s %s %s %s %s %s %s",
#endif
isPowerSave ? "S" : " ", //
Expand Down
Empty file modified utils/k5prog/k5prog
100644 → 100755
Empty file.

0 comments on commit 8111b16

Please sign in to comment.