Commit Graph
60 Commits
Author SHA1 Message Date
Juan Antonio 289418f1c7 Reduce nesting 2023-12-28 22:08:57 +01:00
Juan Antonio ea733115de init.c: Declare loop variables in the loop 2023-12-28 22:08:57 +01:00
Juan Antonio e5cff16d98 Merge guarded code. Simplify DTMF_CheckGroupCall 2023-12-28 22:08:56 +01:00
Juan Antonio 36ecde86e9 Reduce nesting 2023-12-28 22:08:56 +01:00
Juan Antonio cceba5a474 Add missing UI_DisplayClear() 2023-12-26 03:01:24 +01:00
Juan Antonio cbf4a7c140 Use function table. Simplify logic
Size: 60364 -> 60220
2023-12-25 22:49:06 +01:00
Juan Antonio 7a7010da55 Unify PrintSmall functions
Size: 60420 -> 60364
2023-12-25 22:49:06 +01:00
Juan Antonio 78a45d9bbd Create function to zero gFrameBuffer
Size: 60464 -> 60420
2023-12-25 22:49:06 +01:00
Juan Antonio f8ef687026 Use pointers to avoid some string copying
Size: 60664 -> 60464
2023-12-25 22:49:06 +01:00
Juan Antonio 1281bbf033 Remove redundant mensets. Memmove -> memcpy
* The whole gEeprom has been zero'd before. Moreover, strcpy null-terminates.
* There's no aliasing between gEeprom.* and Data.

Size: 60760 -> 60664
2023-12-25 22:49:06 +01:00
Juan Antonio edf1f983d6 Ignore k5_eeprom.raw 2023-12-25 22:49:06 +01:00
Juan Antonio b0d131d546 Fix include directives 2023-12-25 22:49:06 +01:00
Juan Antonio 986c0ce368 Fix RX not honoring Backlight on TX/RX settings properly
Fixes #317
2023-12-24 22:56:35 +01:00
Juan Antonio e929a79765 Move variable declaration outside of guarded region
Fixes #328
2023-12-24 20:55:29 +01:00
Juan Antonio d75209bad0 Rename str_ptr to adhere to the current style 2023-12-24 13:34:05 +01:00
Juan Antonio ee0ba9886d Simplify DTMF_FindContact 2023-12-24 13:34:05 +01:00
Juan Antonio 084fe4dd26 Fix 1750Hz so that it can perform STE
1750Hz and CTCSS tones can be send together.
2023-12-24 13:34:05 +01:00
Juan Antonio a715389a8b Add Doxygen configuration file and makefile target
It can be used to generate sometimes useful call-graphs.
2023-12-24 13:34:05 +01:00
Juan Antonio 6f1cabc807 Simplify gSchedulePowerSave logic
There was quite convoluted logic there, and what I believe, was a bug.

Rationale:

Both,
- gBatterySaveCountdown_10ms = battery_save_count_10ms;, and
- gSchedulePowerSave = false
are always executed inside FUNCTION_Select().

So the code is equivalent to:

if (any of those OR'd) {
	gBatterySaveCountdown_10ms = battery_save_count_10ms;
	gSchedulePowerSave = false; (but only if we have NOAA disabled)
} else {
	[other stuff from FUNCTION_Select()]
	gBatterySaveCountdown_10ms = battery_save_count_10ms;
	gSchedulePowerSave = false; (regarless of having NOAA or not)
}

So:
- OR is true, have NOAA-> don't clear gSchedulePowerSave
	-> implies we will enter here, again, until the OR is false, but only if we have NOAA.
- OR is False -> clear gSchedulePowerSave.

Moreover, checking with DualTachyon code at
https://github.com/DualTachyon/uv-k5-firmware/blob/6f8afac8864e0349ecf8b10f91ce8f69273013db/app/app.c#L747
gSchedulePowerSave is always set to false if it was true.
2023-12-24 13:34:05 +01:00
Juan Antonio a08420a0b7 Simply some logic. Unify some #ifdef regions 2023-12-24 13:34:05 +01:00
Juan Antonio 1f4f026162 Simplify APP_EndTransmission
* Unify Roger-Beep selection
 * Extract function for DTMF EoT
2023-12-24 13:34:05 +01:00
Juan Antonio 34f2168856 Spectrum warp-around when switching steps 2023-12-24 13:34:05 +01:00
Juan Antonio bc9bb489e6 Un-unroll some loops and save a few bytes 2023-12-24 13:34:05 +01:00
Juan Antonio 7d982f1f8d Correct include guard #endif placement 2023-12-22 20:26:07 +01:00
Juan Antonio 2a75f8a9be Refactoring #285
Signed-off-by: Krzysiek Egzmont <egzumer@gmail.com>
2023-12-16 18:34:54 +01:00
Juan Antonio cc49a5007c Fix #275 Backlight does not get back to MAX brightness after exiting backlight menu entries
Backlight is set to FULL when interacting with backlight menu entries,
but it is not set back to MAX when exiting from those entries. This
commit corrects that behaviour.
2023-12-15 13:00:08 +01:00
Juan Antonio a99d2dd1b1 Fix #272: Backlight time doubled 2023-12-15 02:56:25 +01:00
Juan Antonio 9dc79ce868 Fix compilation errors when UART is disabled 2023-12-14 22:03:44 +01:00
Juan Antonio 80fa310646 Fix use of wrong ENABLE guard 2023-12-14 22:03:44 +01:00
Juan Antonio 7f5236c44e Fix compilation errors when FM radio is disabled 2023-12-14 22:03:44 +01:00
Juan Antonio 4b583bf2bd Assign NOP function when the flashlight is disabled 2023-12-14 22:03:44 +01:00
Juan Antonio 1a53586922 Simplify logic in radio.c 2023-12-14 11:11:06 +01:00
Juan Antonio 687b63abb6 Fix signature 2023-12-14 11:11:06 +01:00
Juan Antonio 06f1c651bc Make LogUart receive a const char* const 2023-12-14 11:11:06 +01:00
Juan Antonio 33e4e3c4e0 Make AUDIO_PlayVoice static as it is only used inside of its module 2023-12-14 11:11:06 +01:00
Juan Antonio d0ae34f9b4 Replace memmove by memcpy 2023-12-13 16:07:07 +01:00
Juan Antonio bd17aea72b Make SETTINGS_InitEEPROM zero struct gEeprom 2023-12-13 16:07:07 +01:00
Juan Antonio 34d688b101 Logic simplification. Replace memmove by memcpy 2023-12-13 16:07:07 +01:00
Juan Antonio 8c7f736797 Simplify come battery logic 2023-12-13 16:07:07 +01:00
Juan Antonio a19579a888 Make makefile options settable from envars 2023-12-13 16:07:07 +01:00
Juan Antonio 2e69acbdc4 Fix aircopy bypassing TX restrictions & refactor
And scrapes together a few more bytes.
2023-12-09 19:07:20 +01:00
Juan Antonio a153e63be1 Add function to test if serial configuration is in progress
This was formely tested all over using testing for the state of
gSerialConfigCountDown_500ms in a couple of ways. This logic have been
extracted into a function to make the code more readable.
Also testing it with > 0 was a bit misleading as the variable is
unsigned so tesing with == and != is enough.
2023-12-09 15:50:59 +01:00
Juan Antonio 4322a7d8a9 Drop gScreenToDisplay switch and use function table
Saves some bytes
2023-12-09 15:50:59 +01:00
Juan Antonio 1203fdf0ca Use stepping instead of branching using modulus
Modulus operations are very costly and generally should be avoided.
They also take a few bytes.

This version is actually a quite faster.
2023-12-09 15:50:59 +01:00
Juan Antonio cfc4763dd1 Scrape together a few bytes 2023-12-09 15:50:59 +01:00
Juan Antonio b6a49db31d FM Radio: Simplify logic 2023-12-08 23:18:19 +01:00
Juan Antonio 82ddbcd375 Refactor stepFruencyTable & drop ARRAY_SIZE for frequencyBandTable 2023-12-08 23:17:33 +01:00
Juan Antonio 335c2ec9cd ACTION_Handle: Drop switch in favour of a function array 2023-12-08 01:43:12 +01:00
Juan Antonio 4249d917f8 Refactor of app/action.c
* Extracted funcionts
* Simplified logic of some functions
* Moved things arround a bit. Conditional code moved to the end
2023-12-08 01:43:12 +01:00
Juan Antonio 2164461449 Use function to check if in RX mode 2023-12-08 01:43:12 +01:00
Juan Antonio c3906f42f8 Update .gitignore 2023-12-08 01:43:12 +01:00
Juan Antonio d055fb0024 Reorder audio.c 2023-12-08 01:43:12 +01:00
Juan Antonio c4ad9c6501 Unguard ACTION_OPT_BLMIN_TMP_OFF like the rest 2023-12-08 01:43:12 +01:00
Juan Antonio 4fd1ab8899 Remove redudant symbol 2023-12-08 01:43:12 +01:00
Juan Antonio 754d2ce5fb Make Flashlight optional 2023-12-07 00:46:59 +01:00
Juan Antonio c76a96c3ad Add enum for TR/TX mode 2023-12-07 00:46:59 +01:00
Juan Antonio cd032c39d2 Refactor alarm code
- Fixes Alarms bypassing TX restrictions

- Adds enumerations

- Makes use of mode ALARM_STATE_SITE_ALARM (formely ALARM_STATE_ALARM) instead
  checking against ALARM_STATE_TXALARM && ALARM_MODE == ALARM_MODE_TONE
  all over the place
2023-12-07 00:46:59 +01:00
Juan Antonio 103bdf212f Use enum for Flaslight & return early 2023-12-07 00:44:51 +01:00
Juan Antonio bafe372cbc Simplify backlight logic 2023-12-07 00:44:51 +01:00
Juan Antonio 52bdd408c4 Refactor, merge #186 2023-12-05 02:01:43 +01:00