Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code correctness fixes #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ MOTO_STARTUP_TONE ?= 1
ENABLE_AM_FIX ?= 1
ENABLE_ALT_SQUELCH ?= 1
ENABLE_STATUS_BAR_LINE ?= 0
ENABLE_NOAA ?= 1
ENABLE_NOAA ?= 0
ENABLE_RX_BAR ?= 1
ENABLE_TX_BAR ?= 1
ENABLE_SLOWER_RSSI_TIMER ?= 1
ENABLE_SPECTRUM ?= 1
ENABLE_KEEP_MONITOR_MODE_UP_DN ?= 0
PCB_VER_2_1 ?= 0
ENABLE_SPECTRUM ?= 0
ENABLE_KEEP_MONITOR_MODE_UP_DN ?= 1
PCB_VER_2_1 ?= 1


# Spectrum presets - 1.4 kB
ENABLE_SPECTRUM_PRESETS ?= 1
ENABLE_SPECTRUM_PRESETS ?= 0
# FM radio = 2.6 kB
ENABLE_FM_RADIO ?= 1
# Register Editor = .5 kB
ENABLE_REGISTER_EDIT ?= 0
# Scanlist membership display - 252 B
ENABLE_SCANLIST_DISPLAY ?= 1
ENABLE_SCANLIST_DISPLAY ?= 0
# Space saving options
ENABLE_LTO ?= 0
ENABLE_LTO ?= 1
ENABLE_OPTIMIZED ?= 1


Expand Down Expand Up @@ -166,7 +166,8 @@ GIT_HASH := $(GIT_HASH_TMP)
endif

ASFLAGS = -mcpu=cortex-m4
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m4 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m4 -pipe -free -freorder-blocks-algorithm=stc -std=c2x -MMD
#CFLAGS += -Wextra
CFLAGS += -DAT32F421C8T7
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
Expand All @@ -176,12 +177,9 @@ ifeq ($(ENABLE_OPTIMIZED),1)
CFLAGS += --specs=nano.specs
LDFLAGS += --specs=nano.specs

# Only takes effect when LTO is disabled
CFLAGS += -ffunction-sections
LDFLAGS += -Wl,--gc-sections

CFLAGS += -finline-limit=0

CFLAGS += -fmerge-all-constants
endif

ifeq ($(DEBUG),1)
Expand Down
2 changes: 1 addition & 1 deletion app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void MENU_AcceptSetting(void)
for (i = 0; i < 8; i++) {
gSettingGolay = (gSettingGolay * 10) + (gInputBox[i] - '0');
}
if (gSettingGolay < 0x1000000) {
if (gSettingGolay != 0) {
return;
}
// Illegal code
Expand Down
3 changes: 3 additions & 0 deletions app/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ void RADIO_EndRX(void)
switch (gExtendedSettings.ScanResume) {
case 1: // Carrier Operated
SCANNER_Countdown = 3000;
// Implicit fallthrough
gpio_bits_reset(GPIOA, BOARD_GPIOA_LED_GREEN);
break;
case 2: // Time Operated
gpio_bits_reset(GPIOA, BOARD_GPIOA_LED_GREEN);
break;
Expand Down
2 changes: 1 addition & 1 deletion driver/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void PWM_Pulse(uint16_t Data)

tmr_para_init_ex1(&init);
init.ch1_output_control_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
init.ch1_polarity = TMR_POLARITY_ACTIVE_HIGH;
init.ch1_polarity = (tmr_output_polarity_type)TMR_POLARITY_ACTIVE_HIGH;
init.ch1_enable = TRUE;
init.ch1_digital_filter = Data;
tmr_reset_ex1(TMR3, &init);
Expand Down
2 changes: 1 addition & 1 deletion helper/dtmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void Init(void)
};


for (int i = 0; i < ARRAY_SIZE(init_0x9_values); i++) {
for (unsigned int i = 0; i < ARRAY_SIZE(init_0x9_values); i++) {
BK4819_WriteRegister(0x09, init_0x9_values[i]);
}

Expand Down
2 changes: 1 addition & 1 deletion ui/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static uint8_t LoadAndDraw(uint8_t X, uint8_t Y, uint32_t Offset)
}
}

void FONT_Draw(uint8_t X, uint8_t Y, const uint32_t *pOffsets, uint32_t Count)
void FONT_Draw(uint8_t X, uint8_t Y, uint32_t Count)
{
uint8_t i, x;

Expand Down
2 changes: 1 addition & 1 deletion ui/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdbool.h>
#include <stdint.h>

void FONT_Draw(uint8_t X, uint8_t Y, const uint32_t *pOffsets, uint32_t Count);
void FONT_Draw(uint8_t X, uint8_t Y, uint32_t Count);
uint8_t FONT_GetOffsets(const char *String, uint8_t Size, bool bFlag);

#endif
Expand Down
13 changes: 7 additions & 6 deletions ui/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static const uint8_t BitmapRadar[] = {

void UI_DrawString(uint8_t X, uint8_t Y, const char *pString, uint8_t Size)
{
FONT_Draw(X, Y, SFLASH_FontOffsets, FONT_GetOffsets(pString, Size, true));
FONT_Draw(X, Y, FONT_GetOffsets(pString, Size, true));
}

void UI_DrawSmallCharacter(uint8_t X, uint8_t Y, char Digit)
Expand Down Expand Up @@ -714,7 +714,7 @@ void UI_DrawDTMF(void)

void UI_DrawFMFrequency(uint16_t Frequency)
{
Int2Ascii(gSettings.FmFrequency, 4);
Int2Ascii(Frequency, 4);
gShortString[4] = gShortString[3];
gShortString[3] = '.';
gColorForeground = COLOR_BLUE;
Expand Down Expand Up @@ -963,11 +963,12 @@ void UI_DrawGolay(void)
for (i = 0; i < 8; i++) {
gSettingGolay = (gSettingGolay * 10) + (gInputBox[i] - '0');
}
if (gSettingGolay > 0xFFFFFF) {
gSettingGolay &= 0xFFFFFF;
Int2Ascii(gSettingGolay, 8);
UI_DrawString(24, 24, gShortString, 8);
if (gSettingGolay != 0) {
return;
}
gSettingGolay &= 0xFFFFFF;
Int2Ascii(gSettingGolay, 8);
UI_DrawString(24, 24, gShortString, 8);
}

void UI_DrawChannelNumber(const char *pString)
Expand Down