Skip to content

Commit

Permalink
Add missed call notification and blinking led & Fix Slist1+2
Browse files Browse the repository at this point in the history
  • Loading branch information
spm81 committed Mar 11, 2024
1 parent 9aa217c commit 8bec44b
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENABLE_AIRCOPY := 0
ENABLE_FMRADIO := 1
# 84 bytes
ENABLE_FLASHLIGHT_SOS := 1
ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED := 1
ENABLE_UART := 1
ENABLE_UART_CAT := 0
# Bause we can cut more... - 4108 bytes
Expand All @@ -36,7 +37,7 @@ ENABLE_MDC := 0
# AM Modulation Fix - 544 bytes
ENABLE_AM_FIX := 1
# Apply fix to Spectrum - 40 bytes
ENABLE_AM_FIX_ON_SPECTRUM := 1
ENABLE_AM_FIX_ON_SPECTRUM := 0
ENABLE_SQUELCH_MORE_SENSITIVE := 0
# Restore FM in 1 second after RX - 0 bytes
ENABLE_FMRADIO_FAST_RESTORE := 1
Expand Down Expand Up @@ -304,6 +305,8 @@ CFLAGS += -flto=auto
CFLAGS += -ftree-vectorize -funroll-loops
endif



ifeq ($(ENABLE_DOCK),1)
CFLAGS += -DENABLE_DOCK
endif
Expand Down Expand Up @@ -422,6 +425,9 @@ LDFLAGS += -flto
endif
##LDFLAGS += --specs=nosys.specs --specs=nano.specs

ifeq ($(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED),1)
CFLAGS += -DENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED
endif
ifeq ($(ENABLE_NOSCANTIMEOUT),1)
CFLAGS += -DENABLE_NOSCANTIMEOUT
endif
Expand Down Expand Up @@ -538,4 +544,4 @@ clean:

prog: all
$(K5PROG) firmware.bin


25 changes: 24 additions & 1 deletion app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ static void MR_NextChannel(void) {
}
} else {
// Se a lista de varredura não estiver ativada, saímos da função
return;
//return;

}

Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
Expand Down Expand Up @@ -946,6 +947,9 @@ void APP_CheckKeys(void) {
}

void APP_TimeSlice10ms(void) {
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
gFlashLightNotifCounter++;
#endif
gFlashLightBlinkCounter++;

#if defined(ENABLE_UART)
Expand Down Expand Up @@ -1027,6 +1031,18 @@ void APP_TimeSlice10ms(void) {
if (gFlashLightState == FLASHLIGHT_BLINK &&
(gFlashLightBlinkCounter & 15U) == 0) {
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);}

#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)

if (gMissedCalls >0) {

if (gFlashLightNotifCounter >= 10 && gFlashLightNotifCounter <15)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
else if (gFlashLightNotifCounter > 15)
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
//return;
}
#endif
#ifdef ENABLE_FLASHLIGHT_SOS
else if(gFlashLightState == FLASHLIGHT_SOS) {
/* const uint16_t u = 15;
Expand Down Expand Up @@ -1500,6 +1516,13 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
} else {
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
if (Key == KEY_F)
{
gMissedCalls = 0;
}
#endif

if (Key != KEY_PTT) {
gVoltageMenuCountdown = 0x10;
}
Expand Down
4 changes: 4 additions & 0 deletions app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ void APP_Update(void);
void APP_TimeSlice10ms(void);
void APP_TimeSlice500ms(void);

#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
extern volatile uint8_t gFlashLightNotifCounter;
extern uint8_t gMissedCalls;
#endif
#endif

6 changes: 6 additions & 0 deletions functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function) {
if (Function != FUNCTION_POWER_SAVE) {
BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable();
gRxIdleMode = false;
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
gMissedCalls++;
#endif
UI_DisplayStatus();
}
}
Expand Down Expand Up @@ -143,6 +146,9 @@ void FUNCTION_Select(FUNCTION_Type_t Function) {
return;

case FUNCTION_TRANSMIT:
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
gMissedCalls=0;
#endif
#if defined(ENABLE_FMRADIO)
if (gFmRadioMode) {
BK1080_Init(0, false);
Expand Down
5 changes: 5 additions & 0 deletions misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ volatile bool gFlagTteComplete;
volatile bool gScheduleFM;
#endif

#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
uint8_t gMissedCalls;
volatile uint8_t gFlashLightNotifCounter;
#endif

uint16_t gCurrentRSSI;

uint8_t gIsLocked = 0xFF;
Expand Down
5 changes: 4 additions & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ extern volatile bool gFlagTteComplete;
#if defined(ENABLE_FMRADIO)
extern volatile bool gScheduleFM;
#endif

#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
extern uint8_t gMissedCalls;
extern volatile uint8_t gFlashLightNotifCounter;
#endif
#ifdef ENABLE_DOCK
extern bool gSetting_Remote_UI;
#endif
Expand Down
36 changes: 35 additions & 1 deletion ui/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,23 @@
#ifdef ENABLE_DOCK
#include "app/uart.h"
#endif
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)
#include <string.h>
#endif
#ifdef ENABLE_MESSENGER
#ifdef ENABLE_STATUS_BATTERY_PERC
const uint8_t MSG_ICO_POS = 85;
const uint8_t BITMAP_MISSED = 85;

#else
const uint8_t MSG_ICO_POS = 105;
const uint8_t BITMAP_MISSED = 105;
#endif
#endif
void UI_DisplayStatus(void) {



// memset(gStatusLine, 64, sizeof(gStatusLine));
memset(gStatusLine, 0, sizeof(gStatusLine));
#ifdef ENABLE_DOCK
Expand All @@ -53,7 +67,27 @@ void UI_DisplayStatus(void) {
} else {
UI_DisplayBattery(gBatteryDisplayLevel);
}
#if defined(ENABLE_MISSED_CALL_NOTIFICATION_AND_BLINKING_LED)

const uint8_t BITMAP_MISSED = 65;

if (gMissedCalls > 0) { // Indicador de chamada perdida
gStatusLine[BITMAP_MISSED + 0] |= 0b00000001;
gStatusLine[BITMAP_MISSED + 1] |= 0b00000010;
gStatusLine[BITMAP_MISSED + 2] |= 0b00000100;
gStatusLine[BITMAP_MISSED + 3] |= 0b00001000;
gStatusLine[BITMAP_MISSED + 4] |= 0b00010000;
gStatusLine[BITMAP_MISSED + 5] |= 0b00100000;
gStatusLine[BITMAP_MISSED + 6] |= 0b01000000;
gStatusLine[BITMAP_MISSED + 7] |= 0b00100000;
gStatusLine[BITMAP_MISSED + 8] |= 0b00010100;
gStatusLine[BITMAP_MISSED + 9] |= 0b00001100;
gStatusLine[BITMAP_MISSED + 10] |= 0b00001100;
gStatusLine[BITMAP_MISSED + 11] |= 0b00001110;
}


#endif
#ifdef ENABLE_MESSENGER
#ifdef ENABLE_STATUS_BATTERY_PERC
const uint8_t MSG_ICO_POS = 85;
Expand Down Expand Up @@ -170,4 +204,4 @@ void UI_DisplayStatus(void) {
UART_SendUiElement(5, 0, 0, 0, 0, NULL);
UART_SendUiElement(6, val1, val2, val3, (gBatteryVoltageAverage>999?999:gBatteryVoltageAverage)>>2, NULL );
#endif
}
}

0 comments on commit 8bec44b

Please sign in to comment.