diff --git a/Makefile b/Makefile index 12d757e..edcdba4 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ ENABLE_F_CAL_MENU := 0 ENABLE_TX_UNLOCK_MENU := 0 #ENABLE_TX_POWER_CAL_MENU := 0 ENABLE_TX_POWER_FIX := 1 -ENABLE_TX_POWER_LOW_USER := 0 +ENABLE_TX_POWER_LOW_USER := 1 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 ENABLE_CONTRAST := 0 ENABLE_BOOT_BEEPS := 0 diff --git a/README.md b/README.md index e61ac11..39e1780 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ ENABLE_F_CAL_MENU := 0 enable frequency calibration hidden ENABLE_TX_UNLOCK_MENU := 0 allow TX everywhere EXCEPT airband (108~137) .. TX harmonic content will cause interference to other services, do so entirely at your own risk ! ENABLE_TX_POWER_CAL_MENU := 0 used to compute the TX power register values .. leave at '0' ENABLE_TX_POWER_FIX := 1 fix the TX output power, L ~ 10mW, M ~ 500mW, H ~ 4W -ENABLE_TX_POWER_LOW_USER := 1 make the low power setting user settable - adds "TxPUSR" menu option +ENABLE_TX_POWER_LOW_USER := 1 make the low power setting user settable (for local hotspots etc) .. adds "TxPUSR" menu option ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0 standard CTCSS tail phase shift rather than QS's own 55Hz tone method ENABLE_CONTRAST := 0 add contrast menu ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up diff --git a/app/dtmf.c b/app/dtmf.c index 997a097..a803278 100644 --- a/app/dtmf.c +++ b/app/dtmf.c @@ -433,7 +433,7 @@ bool DTMF_Reply(void) if (g_dtmf_call_state != DTMF_CALL_STATE_NONE || g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_APOLLO || g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_OFF || - g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN) + g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_EOT) { g_dtmf_reply_state = DTMF_REPLY_NONE; return false; diff --git a/app/menu.c b/app/menu.c index 00301d0..65a3abb 100644 --- a/app/menu.c +++ b/app/menu.c @@ -439,7 +439,7 @@ void MENU_AcceptSetting(void) #ifdef ENABLE_TX_POWER_LOW_USER case MENU_TX_POWER_LOW_USER: - g_tx_vfo->channel.tx_pwr_user = g_sub_menu_selection; + g_tx_vfo->channel.tx_power_user = g_sub_menu_selection; g_request_save_channel = 1; break; #endif @@ -769,7 +769,7 @@ void MENU_AcceptSetting(void) case MENU_PTT_ID: g_tx_vfo->channel.dtmf_ptt_id_tx_mode = g_sub_menu_selection; - if (g_tx_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN || + if (g_tx_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_EOT || g_tx_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_BOTH || g_tx_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_APOLLO) { @@ -1024,7 +1024,7 @@ void MENU_ShowCurrentSetting(void) #ifdef ENABLE_TX_POWER_LOW_USER case MENU_TX_POWER_LOW_USER: - g_sub_menu_selection = g_tx_vfo->channel.tx_pwr_user; + g_sub_menu_selection = g_tx_vfo->channel.tx_power_user; break; #endif diff --git a/dcs.h b/dcs.h index 8940350..d750901 100644 --- a/dcs.h +++ b/dcs.h @@ -30,8 +30,8 @@ enum dcs_code_type_e typedef enum dcs_code_type_e dcs_code_type_t; enum { - CDCSS_POSITIVE_CODE = 1U, - CDCSS_NEGATIVE_CODE = 2U, + CDCSS_POSITIVE_CODE = 1u, + CDCSS_NEGATIVE_CODE = 2u, }; extern const uint16_t CTCSS_TONE_LIST[50]; diff --git a/driver/bk4819.c b/driver/bk4819.c index 7398f15..d4ae476 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -406,11 +406,13 @@ void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold) void BK4819_set_TX_deviation(const bool narrow) { - const uint8_t scrambler = (BK4819_read_reg(0x31) >> 1) & 1u; - uint16_t deviation = narrow ? 900 : 1232; // 0 ~ 4095 - if (scrambler) - deviation -= 200; - BK4819_write_reg(0x40, (3u << 12) | deviation); +// const uint8_t scrambler = (BK4819_read_reg(0x31) >> 1) & 1u; + uint16_t deviation = narrow ? 900 : 1232; +// if (scrambler) +// deviation -= 200; + if (deviation > 4095) + deviation = 4095; + BK4819_write_reg(0x40, (3u << 12) | deviation); // deviaion 0 ~ 4095 } void BK4819_SetFilterBandwidth(const BK4819_filter_bandwidth_t Bandwidth) @@ -530,7 +532,7 @@ void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency) // 7 = max // 0 = min // - // 280MHz gain 1 = 1 gain 2 = 0 gain 1 = 4 gain 2 = 2 + // 280MHz gain 1 = 1 gain 2 = 0 gain 1 = 4 gain 2 = 2 const uint8_t gain = (frequency == 0) ? 0 : (frequency < rf_filter_transition_freq) ? (1u << 3) | (0u << 0) : (4u << 3) | (2u << 0); const uint8_t enable = 1; BK4819_write_reg(0x36, ((uint16_t)bias << 8) | ((uint16_t)enable << 7) | ((uint16_t)gain << 0)); diff --git a/firmware.bin b/firmware.bin index 504ef6c..2104a10 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 07afd6c..f8fb964 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/radio.c b/radio.c index f48fef5..269a858 100644 --- a/radio.c +++ b/radio.c @@ -632,7 +632,7 @@ void RADIO_ConfigureTXPower(vfo_info_t *p_vfo) #ifdef ENABLE_TX_POWER_LOW_USER if (p_vfo->channel.tx_power == OUTPUT_POWER_LOW) - p_vfo->txp_reg_value = 8 + (p_vfo->channel.tx_pwr_user * 2); + p_vfo->txp_reg_value = 8 + (p_vfo->channel.tx_power_user * 2); else #endif p_vfo->txp_reg_value = FREQUENCY_CalculateOutputPower(tx_power[0], tx_power[1], tx_power[2], p_vfo->p_tx->frequency); @@ -1220,7 +1220,7 @@ void RADIO_tx_eot(void) #endif if (g_dtmf_call_state == DTMF_CALL_STATE_NONE && - (g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN || g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_BOTH)) + (g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_EOT || g_current_vfo->channel.dtmf_ptt_id_tx_mode == PTT_ID_BOTH)) { // end-of-tx if (g_eeprom.config.setting.dtmf.side_tone) { diff --git a/settings.h b/settings.h index 276205e..1078d28 100644 --- a/settings.h +++ b/settings.h @@ -150,8 +150,8 @@ enum compand_e { enum ptt_id_e { PTT_ID_OFF = 0, // OFF - PTT_ID_TX_UP, // BEGIN OF TX - PTT_ID_TX_DOWN, // END OF TX + PTT_ID_BOT, // BEGIN OF TX + PTT_ID_EOT, // END OF TX PTT_ID_BOTH, // BOTH PTT_ID_APOLLO // Apolo quindar tones }; @@ -185,51 +185,51 @@ typedef enum vfo_state_e vfo_state_t; // // 16 bytes typedef struct { - // [0] - uint32_t frequency; // - // [4] - uint32_t tx_offset; // - // [8] - uint8_t rx_ctcss_cdcss_code; // + // [byte 0-3] + uint32_t frequency; // rx frequency / 10 + // [byte 4-7] + uint32_t tx_offset; // tx offset frequency / 10 + // [byte 8] + uint8_t rx_ctcss_cdcss_code; // ctcss 0 ~ 49 cdcss 0 ~ 103 // [9] - uint8_t tx_ctcss_cdcss_code; // + uint8_t tx_ctcss_cdcss_code; // ctcss 0 ~ 49 cdcss 0 ~ 103 // [10] struct { - uint8_t rx_ctcss_cdcss_type:2; // + uint8_t rx_ctcss_cdcss_type:2; // 0=none 1=ctcss 2=cdcss 3=cdcss reverse uint8_t unused1:2; // - uint8_t tx_ctcss_cdcss_type:2; // + uint8_t tx_ctcss_cdcss_type:2; // 0=none 1=ctcss 2=cdcss 3=cdcss reverse uint8_t unused2:2; // }; // [11] struct { uint8_t tx_offset_dir:2; // 0=none 1=neg 2=pos - uint8_t mdc1200_mode:2; // 1of11 + uint8_t mdc1200_mode:2; // 1of11 0=none 1=bot 2=eot 3=both uint8_t mod_mode:2; // 0=FM 1=AM 2=DSB uint8_t unused4:2; // }; // [12] struct { - uint8_t frequency_reverse:1; // reverse repeater - uint8_t channel_bandwidth:1; // wide/narrow - uint8_t tx_power:2; // 0=Low 1=Medium 2=High - uint8_t busy_channel_lock:1; // + uint8_t frequency_reverse:1; // 0=disabled 1=enabled + uint8_t channel_bandwidth:1; // 0=wide (25kHz) 1=narrow (12.5kHz) + uint8_t tx_power:2; // 0=low/user 1=medium 2=high + uint8_t busy_channel_lock:1; // 0=disabled 1=enabled uint8_t unused5:1; // uint8_t compand:2; // 0=off 1=TX 2=RX 3=TX/RX }; // [13] struct { - uint8_t dtmf_decoding_enable:1; // - uint8_t dtmf_ptt_id_tx_mode:3; // - uint8_t squelch_level:4; // 1of11 0 ~ 9 per channel squelch, 0 = use main squelch level + uint8_t dtmf_decoding_enable:1; // 0=disabled 1=enabled + uint8_t dtmf_ptt_id_tx_mode:3; // 0=none 1=bot 2=eot 3=both 4=apollo + uint8_t squelch_level:4; // 1of11 0 = use main squelch level, 1 ~ 9 per channel squelch }; // [14] struct { uint8_t step_setting:4; // step size index 0 ~ 15 - uint8_t tx_pwr_user:4; // 1of11 + uint8_t tx_power_user:4; // 1of11 .. user power setting 0 ~ 15 }; // [15] struct { - uint8_t scrambler:5; // voice inversion scrambler frequency index + uint8_t scrambler:5; // voice inversion scrambler frequency index 0 ~ 31 uint8_t unused7:3; // }; } __attribute__((packed)) t_channel; @@ -491,8 +491,7 @@ typedef struct { } __attribute__((packed)) rssi_cal; // 0x1ED0 - struct - { + struct { union { struct { uint8_t low[3]; // @@ -506,11 +505,19 @@ typedef struct { // 0x1F40 uint16_t battery[6]; // - uint8_t unused1[4]; // 0xff's + #if 1 + // QS + uint8_t unused1[4]; // 0xff's + #else + // 1of11 + struct { + uint16_t wide; // 0 ~ 4095 + uint16_t narrow; // 0 ~ 4095 + } __attribute__((packed)) tx_deviation; + #endif // 0x1F50 - struct - { + struct { uint16_t threshold[10]; // uint8_t unused[4]; // 0xff's } __attribute__((packed)) vox[2]; diff --git a/ui/menu.c b/ui/menu.c index 0f4a750..dd830ef 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -625,6 +625,7 @@ void UI_DisplayMenu(void) // if (g_current_function == FUNCTION_TRANSMIT && g_current_display_screen != DISPLAY_AIRCOPY) // BK4819_SetupPowerAmplifier(8 + (g_sub_menu_selection * 2), g_current_vfo->p_tx->frequency); + channel_setting = true; break; #endif