Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fagci committed Sep 29, 2023
1 parent 5447df0 commit c69a64d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ RegisterSpec registerSpecs[] = {
{"LNA", 0x13, 5, 0b111, 1},
{"PGA", 0x13, 0, 0b111, 1},
{"IF", 0x3D, 0, 0xFFFF, 0x2aaa},
{"MIX", 0x13, 3, 0b11, 1}, // TODO: hidden
// {"MIX", 0x13, 3, 0b11, 1}, // TODO: hidden
};

uint16_t statuslineUpdateTimer = 0;

static uint8_t DBm2S(int dbm) {
uint8_t i = 0;
dbm *= -1;
for (i = 0; i < sizeof(U8RssiMap) / sizeof(U8RssiMap[0]); i++) {
for (i = 0; i < ARRAY_SIZE(U8RssiMap); i++) {
if (dbm >= U8RssiMap[i]) {
return i;
}
Expand Down Expand Up @@ -866,7 +866,7 @@ void OnKeyDownStill(KEY_Code_t key) {
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); */
break;
case KEY_MENU:
if (menuState == sizeof(registerSpecs) / sizeof(registerSpecs[0]) - 1) {
if (menuState == ARRAY_SIZE(registerSpecs) - 1) {
menuState = 1;
} else {
menuState++;
Expand Down
1 change: 1 addition & 0 deletions app/spectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "../driver/systick.h"
#include "../external/printf/printf.h"
#include "../font.h"
#include "../misc.h"
#include "../helper/battery.h"
#include "../radio.h"
#include "../settings.h"
Expand Down
4 changes: 1 addition & 3 deletions ui/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
#include "driver/st7565.h"
#include "external/printf/printf.h"
#include "font.h"
#include "misc.h"
#include "ui/helper.h"
#include "ui/inputbox.h"

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
#endif

void UI_GenerateChannelString(char *pString, uint8_t Channel)
{
Expand Down

0 comments on commit c69a64d

Please sign in to comment.