-
Notifications
You must be signed in to change notification settings - Fork 445
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
ENABLE_ALT_CHANNELS option #471
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,19 +37,114 @@ | |
#endif | ||
|
||
#define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST) | ||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) | ||
#define IS_VFO_CHANNEL(x) ((x) >= VFO_CHANNEL_FIRST && (x) <= VFO_CHANNEL_LAST) | ||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) | ||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST) | ||
|
||
#ifdef ENABLE_ALT_CHANNELS | ||
typedef uint16_t channel_t; | ||
|
||
#define EEPROM_SIZE 0xFFFF //Exact size is 0x10000 but the ckecs are "gret or equal" so a bit off to fit in 2 bytes looks like ok | ||
#define VFO_CHANNELS_COUNT 7 // VFO in each freq band is like a "system channel" | ||
#define FM_CHANNELS_COUNT 20 // are these NOAA? no clue, but let's define them in a constant here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not NOAA, these are FM broadcast radio channels. You don't need that for your modification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Entire NOAA is confusing me, but I think with hints from the chirp driver more pieces fit in place. |
||
#define MR_CHANNELS_COUNT 999 | ||
#define MAX_CHANNEL 0xffff // a mask defining ceil of two bytes | ||
#define ALL_CHANNELS_COUNT (VFO_CHANNELS_COUNT + FM_CHANNELS_COUNT + MR_CHANNELS_COUNT) | ||
|
||
#define EEPROM_MR_FREQ_OFF 0x2000 // Start of the channel relocation | ||
#define EEPROM_MR_FREQ_LEN (MR_CHANNELS_COUNT * 16) | ||
|
||
#define EEPROM_MR_ATTR_OFF (EEPROM_MR_FREQ_OFF + EEPROM_MR_FREQ_LEN) | ||
#define EEPROM_MR_ATTR_LEN (MR_CHANNELS_COUNT) | ||
|
||
#define EEPROM_VFO_ATTR_OFF (EEPROM_MR_ATTR_OFF + EEPROM_MR_ATTR_LEN) | ||
#define EEPROM_VFO_ATTR_LEN (VFO_CHANNELS_COUNT) | ||
|
||
#define EEPROM_MR_SETTINGS_OFF (EEPROM_VFO_ATTR_OFF + EEPROM_VFO_ATTR_LEN) // Screen CH A, MR CH A, Freq CH A, Screen CH B, MR CH B, Freq CH B, NOAA CH A, NOAA CH B | ||
#define EEPROM_MR_SETTINGS_LEN 0x0010 | ||
|
||
#define EEPROM_MR_NAME_OFF (EEPROM_MR_SETTINGS_OFF + EEPROM_MR_SETTINGS_LEN) | ||
#define EEPROM_MR_NAME_LEN (EEPROM_MR_FREQ_LEN) | ||
#define EEPROM_LAST (EEPROM_MR_NAME_OFF + EEPROM_MR_NAME_LEN) | ||
static const uint16_t MR_CHANNEL_FIRST = 0; | ||
static const uint16_t MR_CHANNEL_LAST = (MR_CHANNELS_COUNT - 1); | ||
static const uint16_t VFO_CHANNEL_FIRST = MR_CHANNELS_COUNT; | ||
static const uint16_t VFO_CHANNEL_LAST = (MR_CHANNELS_COUNT + VFO_CHANNELS_COUNT - 1); | ||
static const uint16_t NOAA_CHANNEL_FIRST = (MR_CHANNELS_COUNT + VFO_CHANNELS_COUNT); | ||
static const uint16_t NOAA_CHANNEL_LAST = (MR_CHANNELS_COUNT + VFO_CHANNELS_COUNT + FM_CHANNELS_COUNT -1); | ||
static const uint16_t LAST_CHANNEL = (MR_CHANNELS_COUNT + VFO_CHANNELS_COUNT + FM_CHANNELS_COUNT); | ||
#else | ||
typedef uint8_t channel_t; | ||
|
||
#define EEPROM_SIZE 0x2000 | ||
#define VFO_CHANNELS_COUNT 7 | ||
#define FM_CHANNELS_COUNT 20 | ||
#define MR_CHANNELS_COUNT 200 | ||
#define MAX_CHANNEL 0xff | ||
#define ALL_CHANNELS_COUNT (VFO_CHANNELS_COUNT + FM_CHANNELS_COUNT + MR_CHANNELS_COUNT) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong, you add FM channels, together you get 227, should be 207 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it! |
||
|
||
#define EEPROM_MR_FREQ_OFF 0x0000 | ||
#define EEPROM_MR_FREQ_LEN 0x0C80 | ||
|
||
#define EEPROM_MR_ATTR_OFF 0x0D60 | ||
#define EEPROM_MR_ATTR_LEN 0x00C8 | ||
|
||
#define EEPROM_VFO_ATTR_OFF 0x0E28 | ||
#define EEPROM_VFO_ATTR_LEN 0x0007 | ||
|
||
#define EEPROM_MR_SETTINGS_OFF 0x0E80 | ||
#define EEPROM_MR_SETTINGS_LEN 0x0008 | ||
|
||
#define EEPROM_MR_NAME_OFF 0x0F50 | ||
#define EEPROM_MR_NAME_LEN 0x0C80 | ||
#endif // ENABLE_ALT_CHANNELS | ||
|
||
#define EEPROM_VFO_FREQ_OFF 0x0C80 | ||
#define EEPROM_VFO_FREQ_LEN 0x00E0 | ||
|
||
#define EEPROM_FM_CHANNELS_OFF 0x0E40 | ||
#define EEPROM_FM_CHANNELS_LEN 0x0028 | ||
|
||
#define EEPROM_OPTIONS_0E70_OFF 0x0E70 | ||
#define EEPROM_OPTIONS_0E70_LEN 0x0008 | ||
|
||
#define EEPROM_OPTIONS_0E78_OFF 0x0E78 | ||
#define EEPROM_OPTIONS_0E78_LEN 0x0008 | ||
|
||
#define EEPROM_FM_CH_SETTINGS_OFF 0x0E88 | ||
#define EEPROM_FM_CH_SETTINGS_LEN 0x0003 | ||
|
||
#define EEPROM_WELCOME_STR1_OFF 0x0EB0 | ||
#define EEPROM_WELCOME_STR1_LEN 0x0010 | ||
#define EEPROM_WELCOME_STR2_OFF 0x0EC0 | ||
#define EEPROM_WELCOME_STR2_LEN 0x0010 | ||
|
||
#define EEPROM_CODE_OPTIONS_OFF 0x0ED0 | ||
#define EEPROM_CODE_OPTIONS_LEN 0x000B | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lengths in this section are not needed, they are not use anywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My intentions is to have hints for the expected size, even not used in the code... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. definitions are seen everywhere in the code and shown in IDE hints, it doesn't help. |
||
|
||
#define EEPROM_DTMF_ANI_ID_OFF 0x0EE0 | ||
#define EEPROM_DTMF_ANI_ID_LEN 0x0038 | ||
|
||
#define EEPROM_SCAN_LIST_OFF 0x0F18 | ||
#define EEPROM_SCAN_LIST_LEN 0x0018 | ||
|
||
#define EEPROM_AES_KEY_OFF 0x0F30 | ||
#define EEPROM_AES_KEY_LEN 0x0010 | ||
|
||
#define EEPROM_DTMF_CONTACT_OFF 0x1C00 | ||
#define EEPROM_DTMF_CONTACT_LEN 0x0100 | ||
|
||
#ifndef ENABLE_ALT_CHANNELS | ||
enum { | ||
MR_CHANNEL_FIRST = 0, | ||
MR_CHANNEL_LAST = 199u, | ||
FREQ_CHANNEL_FIRST = 200u, | ||
FREQ_CHANNEL_LAST = 206u, | ||
VFO_CHANNEL_FIRST = 200u, | ||
VFO_CHANNEL_LAST = 206u, | ||
NOAA_CHANNEL_FIRST = 207u, | ||
NOAA_CHANNEL_LAST = 216u, | ||
LAST_CHANNEL | ||
}; | ||
#endif | ||
|
||
enum { | ||
VFO_CONFIGURE_NONE = 0, | ||
|
@@ -186,7 +281,7 @@ typedef union { | |
uint8_t __val; | ||
} ChannelAttributes_t; | ||
|
||
extern ChannelAttributes_t gMR_ChannelAttributes[207]; | ||
extern ChannelAttributes_t gMR_ChannelAttributes[ALL_CHANNELS_COUNT]; | ||
|
||
extern volatile uint16_t gBatterySaveCountdown_10ms; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 (emulated) VFOs (variable frequency oscillator) in this radio.
There is a memory mode, and frequency mode, so MR_CHANNEL or FREQ_CHANNEL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
Will revert to FREQ in the next commit. Just need to finish the chirp driver to be sure everything is in sync and working as expected.