diff --git a/Makefile b/Makefile index ecaa259..7612415 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ ENABLE_UART := 1 ENABLE_UART_DEBUG := 1 ENABLE_AIRCOPY := 1 ENABLE_AIRCOPY_FREQ := 1 +ENABLE_AIRCOPY_RX_REBOOT := 0 ENABLE_FMRADIO := 1 ENABLE_NOAA := 0 ENABLE_VOICE := 0 @@ -247,6 +248,9 @@ endif ifeq ($(ENABLE_AIRCOPY_FREQ),1) CFLAGS += -DENABLE_AIRCOPY_FREQ endif +ifeq ($(ENABLE_AIRCOPY_RX_REBOOT),1) + CFLAGS += -DENABLE_AIRCOPY_RX_REBOOT +endif ifeq ($(ENABLE_FMRADIO),1) CFLAGS += -DENABLE_FMRADIO endif diff --git a/README.md b/README.md index 2955b19..1e709cc 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ ENABLE_UART := 1 without this you can't configure radi ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead) ENABLE_AIRCOPY := 1 clone radio-to-radio via RF ENABLE_AIRCOPY_FREQ := 1 remember what you use for the aircopy frequency +ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver ENABLE_NOAA := 1 everything NOAA (only of any use in the USA) ENABLE_VOICE := 0 want to hear voices ? diff --git a/app/aircopy.c b/app/aircopy.c index 5dbfa75..7785dba 100644 --- a/app/aircopy.c +++ b/app/aircopy.c @@ -556,6 +556,14 @@ void AIRCOPY_process_fsk_rx_10ms(void) { // transfer is complete g_aircopy_state = AIRCOPY_RX_COMPLETE; AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + + #ifdef ENABLE_AIRCOPY_RX_REBOOT + #if defined(ENABLE_OVERLAY) + overlay_FLASH_RebootToBootloader(); + #else + NVIC_SystemReset(); + #endif + #endif } return; diff --git a/firmware.bin b/firmware.bin index e77e700..0b29b3d 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 50adead..149a6ee 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/settings.h b/settings.h index ac4c4c0..b54397c 100644 --- a/settings.h +++ b/settings.h @@ -190,7 +190,7 @@ typedef struct { uint8_t close_glitch_thresh[10]; uint8_t unused6[6]; - } __attribute__((packed)) uhf_squelch[6]; + } __attribute__((packed)) squelch_band_4567[6]; // 0x1E60 struct { @@ -211,20 +211,20 @@ typedef struct { uint8_t close_glitch_thresh[10]; uint8_t unused6[6]; - } __attribute__((packed)) vhf_squelch[6]; + } __attribute__((packed)) squelch_band_123[6]; // 0x1EC0 - uint16_t rssi_band_4567[4]; - uint16_t rssi_band_123[4]; + uint16_t rssi_band_4567[4]; + uint16_t rssi_band_123[4]; // 0x1ED0 struct { - uint8_t low_tx_pwr[3]; - uint8_t mid_tx_pwr[3]; - uint8_t high_tx_pwr[3]; + uint8_t low[3]; + uint8_t mid[3]; + uint8_t high[3]; uint8_t unused[7]; - } band_setting[7]; + } tx_band_power[7]; // 0x1F40 uint16_t battery[6]; @@ -250,7 +250,7 @@ typedef struct { } __attribute__((packed)) t_calibration; -// entire eeprom +// user configuration typedef struct { // 0x0000 @@ -268,7 +268,7 @@ typedef struct { } __attribute__((packed)) vfo_band[7]; } __attribute__((packed)); #endif - + // 0x0D60 struct { // these channel attribute settings could have been in the t_channel structure ! uint8_t band:4; // why do QS have these 4 bits ? .. band can/is computed from the frequency @@ -278,6 +278,8 @@ typedef struct { } __attribute__((packed)) channel_attr[200]; uint8_t unused1[8]; + + // 0x0E30 uint8_t unused2[16]; // 0x0E40 @@ -333,7 +335,7 @@ typedef struct { uint8_t unused7[7]; uint8_t alarm_mode; uint8_t roger_mode; - uint8_t repeater_tail_tone_elimination; // rp_ste + uint8_t repeater_tail_tone_elimination; // rp_ste uint8_t tx_channel; uint8_t air_copy_freq; // 1of11 @@ -361,6 +363,8 @@ typedef struct { uint8_t dtmf_revive_code[8]; uint8_t dtmf_key_up_code[16]; uint8_t dtmf_key_down_code[16]; + + // 0x0F18 uint8_t s_list_default; uint8_t priority1_enable; uint8_t priority1_channel1; @@ -374,10 +378,10 @@ typedef struct { uint8_t unused11[8]; // 0x0F30 - uint8_t aes_key[16]; // disabled = all 0xff + uint8_t aes_key[16]; // disabled = all 0xff // 0x0F40 - uint8_t freq_lock; // + uint8_t freq_lock; // uint8_t enable_tx_350; // 350MHz ~ 400MHz uint8_t killed; // uint8_t enable_tx_200; // @@ -386,9 +390,9 @@ typedef struct { uint8_t enable_scrambler; // #if 0 // QS - uint8_t unused12[9]; + uint8_t unused12[9]; // #else - // 1of11 .. some of my additional settings + // 1of11 uint8_t tx_enable:1; // 0 = completely disable TX, 1 = allow TX uint8_t dtmf_live_decoder:1; // 1 = enable on-screen live DTMF decoder uint8_t battery_text:2; // 0 = no battery text, 1 = voltage, 2 = percent .. on the status bar @@ -396,27 +400,36 @@ typedef struct { uint8_t am_fix:1; // 1 = RX AM fix uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX - uint8_t unused12[8]; + uint8_t unused12[8]; // #endif // 0x0F50 - char channel_name[200][16]; // each channels name text + char channel_name[200][16]; // each channels name text (max 10 chars used per channel) // 0x1BD0 - uint8_t unused13[16]; - uint8_t unused14[16]; - uint8_t unused15[16]; + uint8_t unused13[16 * 3]; // free to use // 0x1C00 - uint8_t dtmf_contact[16][16]; + struct { + char name[8]; + uint8_t number[8]; + } __attribute__((packed)) dtmf_contact[16]; + +} __attribute__((packed)) t_config; + +// entire eeprom +typedef struct { + + // 0x0000 + t_config config; // radios user config // 0x1D00 - uint8_t unused16[256]; // lots of unused area we could make use of + uint8_t unused14[256]; // does this belong to the config, or the calibration, or neither ? // 0x1E00 - t_calibration calibration; // the radios calibration/general settings + t_calibration calibration; // calibration settings .. we DO NOT pass this through aircopy, it's radio specific -} __attribute__((packed)) t_eeprom; +} __attribute__((packed)) t_eeprom; // 8192 bytes of eeprom // ************************************************ // this and all the other variables are going to be replaced with the above t_eeprom diff --git a/ui/main.c b/ui/main.c index 719526c..c40f07b 100644 --- a/ui/main.c +++ b/ui/main.c @@ -450,19 +450,27 @@ void UI_DisplayMain(void) if (g_dtmf_call_state != DTMF_CALL_STATE_NONE || g_dtmf_is_tx || g_dtmf_input_mode) { // show DTMF stuff - char Contact[16]; + char contact[17]; if (!g_dtmf_input_mode) { - memset(Contact, 0, sizeof(Contact)); + memset(contact, 0, sizeof(contact)); if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT) - strcpy(String, (g_dtmf_state == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT"); + { + strcpy(String, (g_dtmf_state == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT RESP" : "CALL OUT"); + } else if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY) - sprintf(String, "CALL FRM:%s", (DTMF_FindContact(g_dtmf_caller, Contact)) ? Contact : g_dtmf_caller); + { + const bool found = DTMF_FindContact(g_dtmf_caller, contact); + contact[8] = 0; + sprintf(String, "FROM %s", found ? contact : g_dtmf_caller); + } else if (g_dtmf_is_tx) - strcpy(String, (g_dtmf_state == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX"); + { + strcpy(String, (g_dtmf_state == DTMF_STATE_TX_SUCC) ? "DTMF TX SUCC" : "DTMF TX"); + } } else { @@ -473,15 +481,25 @@ void UI_DisplayMain(void) memset(String, 0, sizeof(String)); if (!g_dtmf_input_mode) { - memset(Contact, 0, sizeof(Contact)); + memset(contact, 0, sizeof(contact)); if (g_dtmf_call_state == DTMF_CALL_STATE_CALL_OUT) - sprintf(String, ">%s", (DTMF_FindContact(g_dtmf_string, Contact)) ? Contact : g_dtmf_string); + { + const bool found = DTMF_FindContact(g_dtmf_string, contact); + contact[15] = 0; + sprintf(String, ">%s", found ? contact : g_dtmf_string); + } else if (g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED || g_dtmf_call_state == DTMF_CALL_STATE_RECEIVED_STAY) - sprintf(String, ">%s", (DTMF_FindContact(g_dtmf_callee, Contact)) ? Contact : g_dtmf_callee); + { + const bool found = DTMF_FindContact(g_dtmf_callee, contact); + contact[15] = 0; + sprintf(String, ">%s", found ? contact : g_dtmf_callee); + } else if (g_dtmf_is_tx) + { sprintf(String, ">%s", g_dtmf_string); + } } UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);