mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Added 'make clean' to win_make.bat
This commit is contained in:
parent
b0794ec582
commit
470297ea25
128
am_fix.c
128
am_fix.c
@ -99,7 +99,10 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
//
|
//
|
||||||
// these 4 tables need a measuring/calibration update
|
// these 4 tables need a measuring/calibration update
|
||||||
//
|
//
|
||||||
// QUESTION: why do I have to surround the negative numbers in brackets ??? .. if I don't then the table contains wrong numbers
|
//
|
||||||
|
// QUESTION: why do I have to surround the negative numbers in brackets ???
|
||||||
|
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||||
|
//
|
||||||
//
|
//
|
||||||
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||||
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||||
@ -230,32 +233,33 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the total gain for each table index
|
// total RF gain for each table index
|
||||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
||||||
|
|
||||||
|
// display update rate
|
||||||
|
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||||
unsigned int counter = 0;
|
unsigned int counter = 0;
|
||||||
|
|
||||||
int16_t orig_dB_gain = -17;
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
|
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||||
unsigned int gain_table_index[2] = {1 + gSetting_AM_fix_test1, 1 + gSetting_AM_fix_test1};
|
unsigned int gain_table_index[2] = {1 + gSetting_AM_fix_test1, 1 + gSetting_AM_fix_test1};
|
||||||
#else
|
#else
|
||||||
unsigned int gain_table_index[2] = {original_index, original_index};
|
unsigned int gain_table_index[2] = {original_index, original_index};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// used to simply detect we've changed our table index/register settings
|
// used simply to detect a changed gain setting
|
||||||
unsigned int gain_table_index_prev[2] = {0, 0};
|
unsigned int gain_table_index_prev[2] = {0, 0};
|
||||||
|
|
||||||
// holds the previous RSSI level
|
// holds the previous RSSI level .. we do an average of old + new RSSI reading
|
||||||
int16_t prev_rssi[2] = {0, 0};
|
int16_t prev_rssi[2] = {0, 0};
|
||||||
|
|
||||||
// to help reduce gain hunting, provides a peak hold time delay
|
// to help reduce gain hunting, peak hold count down tick
|
||||||
unsigned int am_gain_hold_counter[2] = {0, 0};
|
unsigned int hold_counter[2] = {0, 0};
|
||||||
|
|
||||||
// used to correct the RSSI readings after our front end gain adjustments
|
// used to correct the RSSI readings after our RF gain adjustments
|
||||||
int16_t rssi_db_gain_diff[2] = {0, 0};
|
int16_t rssi_gain_diff[2] = {0, 0};
|
||||||
|
|
||||||
// used to limit the max front end gain
|
// used to limit the max RF gain
|
||||||
unsigned int max_index = ARRAY_SIZE(gain_table) - 1;
|
unsigned int max_index = ARRAY_SIZE(gain_table) - 1;
|
||||||
|
|
||||||
#ifndef ENABLE_AM_FIX_TEST1
|
#ifndef ENABLE_AM_FIX_TEST1
|
||||||
@ -277,39 +281,39 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-compute the total gain DB for each table index
|
// pre-compute the total gain for each table index .. saves doing it in real time
|
||||||
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
||||||
{
|
{
|
||||||
const t_gain_table gains = gain_table[i];
|
const t_gain_table gains = gain_table[i];
|
||||||
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_dB_gain = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{ // set a maximum gain to use
|
{ // set a maximum gain to use
|
||||||
// const int16_t max_gain_dB = orig_dB_gain;
|
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||||
const int16_t max_gain_dB = -10;
|
const int16_t max_gain_dB = -10;
|
||||||
|
|
||||||
max_index = ARRAY_SIZE(gain_table);
|
max_index = ARRAY_SIZE(gain_table);
|
||||||
while (--max_index > 1)
|
while (--max_index > 1)
|
||||||
if (gain_dB[max_index] <= max_gain_dB)
|
if (gain_dB[max_index] <= max_gain_dB)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
// use the full range of available gains
|
||||||
max_index = ARRAY_SIZE(gain_table) - 1;
|
max_index = ARRAY_SIZE(gain_table) - 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AM_fix_reset(const int vfo)
|
void AM_fix_reset(const int vfo)
|
||||||
{ // reset the AM fixer
|
{ // reset the AM fixer upper
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
|
||||||
prev_rssi[vfo] = 0;
|
prev_rssi[vfo] = 0;
|
||||||
|
|
||||||
am_gain_hold_counter[vfo] = 0;
|
hold_counter[vfo] = 0;
|
||||||
|
|
||||||
rssi_db_gain_diff[vfo] = 0;
|
rssi_gain_diff[vfo] = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// gain_table_index[vfo] = 1 + gSetting_AM_fix_test1;
|
// gain_table_index[vfo] = 1 + gSetting_AM_fix_test1;
|
||||||
@ -320,32 +324,28 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
gain_table_index_prev[vfo] = 0;
|
gain_table_index_prev[vfo] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust the RX RF gain to try and prevent the AM demodulator from
|
// adjust the RX gain to try and prevent the AM demodulator from
|
||||||
// saturating/overloading/clipping (distorted AM audio)
|
// saturating/overloading/clipping (distorted AM audio)
|
||||||
//
|
//
|
||||||
// we're actually doing the BK4819's job for it here, but as the chip
|
// we're actually doing the BK4819's job for it here, but as the chip
|
||||||
// won't/don't do it for itself, we're left to bodging it ourself by
|
// won't/don't do it for itself, we're left to bodging it ourself by
|
||||||
// playing with the RF front end gain settings
|
// playing with the RF front end gain setting
|
||||||
//
|
//
|
||||||
void AM_fix_adjust_frontEnd_10ms(const int vfo)
|
void AM_fix_10ms(const int vfo)
|
||||||
{
|
{
|
||||||
int16_t diff_dB;
|
int16_t diff_dB;
|
||||||
int16_t rssi;
|
int16_t rssi;
|
||||||
|
|
||||||
// but we're not in FM mode, we're in AM mode
|
|
||||||
|
|
||||||
switch (gCurrentFunction)
|
switch (gCurrentFunction)
|
||||||
{
|
{
|
||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
counter = 0;
|
counter = display_update_rate - 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FUNCTION_FOREGROUND:
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// only adjust stuff if we're in one of these modes
|
// only adjust stuff if we're in one of these modes
|
||||||
|
case FUNCTION_FOREGROUND:
|
||||||
case FUNCTION_RECEIVE:
|
case FUNCTION_RECEIVE:
|
||||||
case FUNCTION_MONITOR:
|
case FUNCTION_MONITOR:
|
||||||
case FUNCTION_INCOMING:
|
case FUNCTION_INCOMING:
|
||||||
@ -354,8 +354,8 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
if (counter > 0)
|
if (counter > 0)
|
||||||
{
|
{
|
||||||
if (++counter >= 20) // limit display update rate to 200ms
|
if (++counter >= display_update_rate)
|
||||||
{
|
{ // trigger a display update
|
||||||
counter = 0;
|
counter = 0;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@ -365,17 +365,16 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||||
const int16_t new_rssi = BK4819_GetRSSI();
|
const int16_t new_rssi = BK4819_GetRSSI();
|
||||||
rssi = (prev_rssi[vfo] > 0) ? (prev_rssi[vfo] + new_rssi) / 2 : new_rssi;
|
rssi = (prev_rssi[vfo] > 0) ? (prev_rssi[vfo] + new_rssi) / 2 : new_rssi;
|
||||||
// rssi = (new_rssi > prev_rssi[vfo] && prev_rssi[vfo] > 0) ? (prev_rssi[vfo] + new_rssi) / 2 : new_rssi;
|
|
||||||
prev_rssi[vfo] = new_rssi;
|
prev_rssi[vfo] = new_rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // save the corrected RSSI level
|
{ // save the corrected RSSI level
|
||||||
const int16_t new_rssi = rssi - (rssi_db_gain_diff[vfo] * 2);
|
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
||||||
if (gCurrentRSSI[vfo] != new_rssi)
|
if (gCurrentRSSI[vfo] != new_rssi)
|
||||||
{
|
{
|
||||||
gCurrentRSSI[vfo] = new_rssi;
|
gCurrentRSSI[vfo] = new_rssi;
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
{
|
{ // trigger a display update
|
||||||
counter = 1;
|
counter = 1;
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@ -391,13 +390,16 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
if (gain_table_index[vfo] == i)
|
if (gain_table_index[vfo] == i)
|
||||||
return; // no change
|
return; // no change
|
||||||
|
|
||||||
|
gain_table_index[vfo] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// automatically adjust the RF RX gain
|
// automatically adjust the RF RX gain
|
||||||
|
|
||||||
if (am_gain_hold_counter[vfo] > 0)
|
// update the gain hold counter
|
||||||
am_gain_hold_counter[vfo]--;
|
if (hold_counter[vfo] > 0)
|
||||||
|
hold_counter[vfo]--;
|
||||||
|
|
||||||
// dB difference between actual and desired RSSI level
|
// dB difference between actual and desired RSSI level
|
||||||
diff_dB = (rssi - desired_rssi) / 2;
|
diff_dB = (rssi - desired_rssi) / 2;
|
||||||
@ -432,22 +434,22 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
if (gain_table_index[vfo] != index)
|
if (gain_table_index[vfo] != index)
|
||||||
{
|
{
|
||||||
gain_table_index[vfo] = index;
|
gain_table_index[vfo] = index;
|
||||||
am_gain_hold_counter[vfo] = 30; // 300ms hold
|
hold_counter[vfo] = 30; // 300ms hold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff_dB >= -4) // 4dB hysterisis (help reduce gain hunting)
|
if (diff_dB >= -4) // 4dB hysterisis (help reduce gain hunting)
|
||||||
am_gain_hold_counter[vfo] = 30; // 300ms hold
|
hold_counter[vfo] = 30; // 300ms hold
|
||||||
|
|
||||||
if (am_gain_hold_counter[vfo] == 0)
|
if (hold_counter[vfo] == 0)
|
||||||
{ // hold has been released, we're free to increase gain
|
{ // hold has been released/timed-out, we're free to increase gain
|
||||||
const unsigned int index = gain_table_index[vfo] + 1;
|
const unsigned int index = gain_table_index[vfo] + 1; // move up to next gain table index
|
||||||
gain_table_index[vfo] = (index > max_index) ? max_index : index; // limit the gain
|
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index and save it
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||||
return; // no gain changes have been made
|
return; // no gain change
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -455,52 +457,38 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
const unsigned int index = gain_table_index[vfo];
|
const unsigned int index = gain_table_index[vfo];
|
||||||
|
|
||||||
const t_gain_table gains = gain_table[index];
|
// remember the new table index
|
||||||
|
gain_table_index_prev[vfo] = index;
|
||||||
|
|
||||||
|
const t_gain_table gains = gain_table[index];
|
||||||
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||||
|
|
||||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||||
|
|
||||||
// gain difference from original QS setting
|
// RF gain difference from original QS setting
|
||||||
rssi_db_gain_diff[vfo] = (int16_t)gain_dB[index] - orig_dB_gain;
|
rssi_gain_diff[vfo] = ((int16_t)gain_dB[index] - gain_dB[original_index]) * 2;
|
||||||
|
|
||||||
// remember the new table index
|
|
||||||
gain_table_index_prev[vfo] = index;
|
|
||||||
|
|
||||||
{ // save the corrected RSSI level
|
|
||||||
const int16_t new_rssi = rssi - (rssi_db_gain_diff[vfo] * 2);
|
|
||||||
if (gCurrentRSSI[vfo] != new_rssi)
|
|
||||||
{
|
|
||||||
gCurrentRSSI[vfo] = new_rssi;
|
|
||||||
if (counter == 0)
|
|
||||||
{
|
|
||||||
counter = 1;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
// save the corrected RSSI level
|
||||||
if (counter == 0)
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
{
|
|
||||||
counter = 1;
|
if (counter == 0)
|
||||||
gUpdateDisplay = true;
|
{
|
||||||
}
|
counter = 1;
|
||||||
#endif
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
|
||||||
void AM_fix_print_data(const int vfo, char *s)
|
void AM_fix_print_data(const int vfo, char *s)
|
||||||
{
|
{
|
||||||
// fetch current register settings
|
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
{
|
{
|
||||||
const unsigned int index = gain_table_index[vfo];
|
const unsigned int index = gain_table_index[vfo];
|
||||||
sprintf(s, "idx %2d %4ddB %3u", index, gain_dB[index], prev_rssi[vfo]);
|
sprintf(s, "idx %2d %4ddB %3u", index, gain_dB[index], prev_rssi[vfo]);
|
||||||
|
//counter = 1;
|
||||||
}
|
}
|
||||||
counter = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
4
am_fix.h
4
am_fix.h
@ -26,11 +26,11 @@ extern const uint8_t orig_mixer;
|
|||||||
extern const uint8_t orig_pga;
|
extern const uint8_t orig_pga;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
extern int16_t rssi_db_gain_diff[2];
|
extern int16_t rssi_gain_diff[2];
|
||||||
|
|
||||||
void AM_fix_init(void);
|
void AM_fix_init(void);
|
||||||
void AM_fix_reset(const int vfo);
|
void AM_fix_reset(const int vfo);
|
||||||
void AM_fix_adjust_frontEnd_10ms(const int vfo);
|
void AM_fix_10ms(const int vfo);
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
void AM_fix_print_data(const int vfo, char *s);
|
void AM_fix_print_data(const int vfo, char *s);
|
||||||
#endif
|
#endif
|
||||||
|
11
app/app.c
11
app/app.c
@ -68,11 +68,16 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
|||||||
static void updateRSSI(const int vfo)
|
static void updateRSSI(const int vfo)
|
||||||
{
|
{
|
||||||
int16_t rssi = BK4819_GetRSSI();
|
int16_t rssi = BK4819_GetRSSI();
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
// with compensation
|
// add RF gain adjust compensation
|
||||||
if (gEeprom.VfoInfo[vfo].IsAM && gSetting_AM_fix)
|
if (gEeprom.VfoInfo[vfo].IsAM && gSetting_AM_fix)
|
||||||
rssi -= rssi_db_gain_diff[vfo] * 2;
|
rssi -= rssi_gain_diff[vfo];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (gCurrentRSSI[vfo] == rssi)
|
||||||
|
return; // no change
|
||||||
|
|
||||||
gCurrentRSSI[vfo] = rssi;
|
gCurrentRSSI[vfo] = rssi;
|
||||||
|
|
||||||
UI_UpdateRSSI(rssi, vfo);
|
UI_UpdateRSSI(rssi, vfo);
|
||||||
@ -1336,7 +1341,7 @@ void APP_TimeSlice10ms(void)
|
|||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].IsAM && gSetting_AM_fix)
|
if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].IsAM && gSetting_AM_fix)
|
||||||
AM_fix_adjust_frontEnd_10ms(gEeprom.RX_CHANNEL);
|
AM_fix_10ms(gEeprom.RX_CHANNEL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (UART_IsCommandAvailable())
|
if (UART_IsCommandAvailable())
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
14
ui/main.c
14
ui/main.c
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
@ -425,13 +426,12 @@ void UI_DisplayMain(void)
|
|||||||
// dBm
|
// dBm
|
||||||
//
|
//
|
||||||
// this doesn't yet quite fit into the available screen space
|
// this doesn't yet quite fit into the available screen space
|
||||||
const int16_t rssi = gVFO_RSSI[vfo_num];
|
// I suppose the '-' sign could be dropped
|
||||||
if (rssi > 0)
|
//
|
||||||
{
|
const int16_t dBm = (gVFO_RSSI[vfo_num] / 2) - 160;
|
||||||
const int16_t dBm = (rssi / 2) - 160;
|
sprintf(String, "%-3d", dBm);
|
||||||
sprintf(String, "%-3d", dBm);
|
//sprintf(String, "%3d", abs(dBm));
|
||||||
UI_PrintStringSmall(String, 2, 0, Line + 2);
|
UI_PrintStringSmall(String, 2, 0, Line + 2);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
// bar graph
|
// bar graph
|
||||||
if (gVFO_RSSI_bar_level[vfo_num] > 0)
|
if (gVFO_RSSI_bar_level[vfo_num] > 0)
|
||||||
|
30
ui/rssi.c
30
ui/rssi.c
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "driver/st7565.h"
|
#include "driver/st7565.h"
|
||||||
@ -29,9 +30,11 @@
|
|||||||
#ifdef ENABLE_DBM
|
#ifdef ENABLE_DBM
|
||||||
|
|
||||||
void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||||
{ // dBm
|
{
|
||||||
|
// dBm
|
||||||
//
|
//
|
||||||
// this doesn't yet quite fit into the available screen space
|
// this doesn't yet quite fit into the available screen space
|
||||||
|
// I suppose the '-' sign could be dropped
|
||||||
|
|
||||||
char s[8];
|
char s[8];
|
||||||
const uint8_t line = (vfo == 0) ? 3 : 7;
|
const uint8_t line = (vfo == 0) ? 3 : 7;
|
||||||
@ -42,9 +45,10 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
gVFO_RSSI[vfo] = rssi;
|
gVFO_RSSI[vfo] = rssi;
|
||||||
gVFO_RSSI_bar_level[vfo] = 0;
|
gVFO_RSSI_bar_level[vfo] = 0;
|
||||||
|
|
||||||
{ // drop the '.5'
|
{ // drop the '.5' bit
|
||||||
const int16_t dBm = (rssi / 2) - 160;
|
const int16_t dBm = (rssi / 2) - 160;
|
||||||
sprintf(s, "%-3d", dBm);
|
sprintf(s, "%-3d", dBm);
|
||||||
|
// sprintf(s, "%3d", abs(dBm));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(s, " ");
|
strcpy(s, " ");
|
||||||
@ -113,19 +117,19 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
|||||||
#if 0
|
#if 0
|
||||||
//const unsigned int band = gRxVfo->Band;
|
//const unsigned int band = gRxVfo->Band;
|
||||||
const unsigned int band = 0;
|
const unsigned int band = 0;
|
||||||
const uint16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||||
const uint16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||||
const uint16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||||
const uint16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
|
||||||
#else
|
#else
|
||||||
const uint16_t level0 = (-115 + 160) * 2; // dB
|
const int16_t level0 = (-115 + 160) * 2; // dB
|
||||||
const uint16_t level1 = ( -89 + 160) * 2; // dB
|
const int16_t level1 = ( -89 + 160) * 2; // dB
|
||||||
const uint16_t level2 = ( -64 + 160) * 2; // dB
|
const int16_t level2 = ( -64 + 160) * 2; // dB
|
||||||
const uint16_t level3 = ( -39 + 160) * 2; // dB
|
const int16_t level3 = ( -39 + 160) * 2; // dB
|
||||||
#endif
|
#endif
|
||||||
const uint16_t level01 = (level0 + level1) / 2;
|
const int16_t level01 = (level0 + level1) / 2;
|
||||||
const uint16_t level12 = (level1 + level2) / 2;
|
const int16_t level12 = (level1 + level2) / 2;
|
||||||
const uint16_t level23 = (level2 + level3) / 2;
|
const int16_t level23 = (level2 + level3) / 2;
|
||||||
|
|
||||||
uint8_t Level = 0;
|
uint8_t Level = 0;
|
||||||
|
|
||||||
|
10
win_make.bat
10
win_make.bat
@ -14,13 +14,13 @@
|
|||||||
::
|
::
|
||||||
:: 4. You may (or may not) need to reboot windows after installing the above
|
:: 4. You may (or may not) need to reboot windows after installing the above
|
||||||
::
|
::
|
||||||
:: You can then run this bat from the directory you saved this source code too.
|
:: You can then run this bat from the directory you saved the firmware source code too.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:: Delete any left over files from any previous compile
|
:: Delete any left over files from previous compile
|
||||||
::
|
::
|
||||||
del /S /Q *.o >nul 2>nul
|
del /S /Q *.o >nul 2>nul
|
||||||
del /S /Q *.d >nul 2>nul
|
del /S /Q *.d >nul 2>nul
|
||||||
@ -29,13 +29,15 @@ del /Q *.bin >nul 2>nul
|
|||||||
|
|
||||||
:: You may need to edit/change these three paths to suit your setup
|
:: You may need to edit/change these three paths to suit your setup
|
||||||
::
|
::
|
||||||
|
:: Temporarily add the compiler and make program directories to the system PATH ..
|
||||||
|
::
|
||||||
@set PATH="C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin";%PATH%
|
@set PATH="C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin";%PATH%
|
||||||
@set PATH="C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\arm-none-eabi\bin";%PATH%
|
@set PATH="C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\arm-none-eabi\bin";%PATH%
|
||||||
@set PATH="C:\Program Files (x86)\GnuWin32\bin\";%PATH%
|
@set PATH="C:\Program Files (x86)\GnuWin32\bin\";%PATH%
|
||||||
|
|
||||||
:: Do the compile
|
:: Do the compile
|
||||||
::
|
::
|
||||||
::"C:\Program Files (x86)\GnuWin32\bin\make"
|
make clean
|
||||||
make
|
make
|
||||||
|
|
||||||
:: Delete the spent files
|
:: Delete the spent files
|
||||||
@ -58,7 +60,7 @@ del /Q firmware >nul 2>nul
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
:: These two lines just install the required initial python module if you want to create the packed
|
:: One of these two lines simply install the required python module if you want to create the packed
|
||||||
:: firmware bin file, either only needs running once, ever.
|
:: firmware bin file, either only needs running once, ever.
|
||||||
::
|
::
|
||||||
::python -m pip install --upgrade pip crcmod
|
::python -m pip install --upgrade pip crcmod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user