diff --git a/README.md b/README.md index 114ee68..5d375c3 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,11 @@ Anyway, have fun. Please note that the Quansheng uv-k radios are not professional quality transceivers, their performance is strictly limited, somewhat below that of a decent transceiver. The RX front end has no track-tuned band pass filtering at all, and so are wide band/wide open to any -and all signals over a wide frequency range. Using the radio in high intensity RF environments -will nearly always destroy your reception, the receiver simply doesn't have a great dynamic -range, though are quite sensitive (weak signal wise). +and all signals over a wide frequency range. +Using the radio in high intensity RF environments will nearly always destroy your reception, +the receiver simply doesn't have a great dynamic range, which means distorted AM audio with +strong received signals, there is nothing more anyone can do in firmware/software to stop that +happening once the RX gain adjustment I do (AM fix) reaches the hardwares limit. Saying that, they are nice toys for the price, fun to play with. diff --git a/firmware.bin b/firmware.bin index 5934166..2f4e92b 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 0dcef70..f621d86 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/helper/battery.c b/helper/battery.c index 77bce6a..241090d 100644 --- a/helper/battery.c +++ b/helper/battery.c @@ -86,37 +86,22 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel) gBatteryDisplayLevel = 0; - if (Voltage >= gBatteryCalibration[5]) - gBatteryDisplayLevel = 11; - else - if (Voltage >= ((gBatteryCalibration[4] + gBatteryCalibration[5]) / 2)) - gBatteryDisplayLevel = 10; - else - if (Voltage >= gBatteryCalibration[4]) - gBatteryDisplayLevel = 9; - else - if (Voltage >= ((gBatteryCalibration[3] + gBatteryCalibration[4]) / 2)) - gBatteryDisplayLevel = 8; - else - if (Voltage >= gBatteryCalibration[3]) - gBatteryDisplayLevel = 7; - else - if (Voltage >= ((gBatteryCalibration[2] + gBatteryCalibration[3]) / 2)) + if (gBatteryCalibration[5] < Voltage) gBatteryDisplayLevel = 6; else - if (Voltage >= gBatteryCalibration[2]) + if (gBatteryCalibration[4] < Voltage) gBatteryDisplayLevel = 5; else - if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2)) + if (gBatteryCalibration[3] < Voltage) gBatteryDisplayLevel = 4; else - if (Voltage >= gBatteryCalibration[1]) + if (gBatteryCalibration[2] < Voltage) gBatteryDisplayLevel = 3; else - if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2)) + if (gBatteryCalibration[1] < Voltage) gBatteryDisplayLevel = 2; else - if (Voltage >= gBatteryCalibration[0]) + if (gBatteryCalibration[0] < Voltage) gBatteryDisplayLevel = 1; gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3]; diff --git a/main.c b/main.c index 9f1c9d6..ebb0da8 100644 --- a/main.c +++ b/main.c @@ -132,7 +132,7 @@ void Main(void) gDebounceCounter = 0; } - if (!gChargingWithTypeC && !gBatteryDisplayLevel) + if (!gChargingWithTypeC && gBatteryDisplayLevel == 0) { FUNCTION_Select(FUNCTION_POWER_SAVE); diff --git a/radio.c b/radio.c index 4b2c14e..c3a2ca9 100644 --- a/radio.c +++ b/radio.c @@ -962,8 +962,7 @@ void RADIO_PrepareTX(void) if (gBatteryDisplayLevel == 0) State = VFO_STATE_BAT_LOW; // charge your battery ! else - //if (gBatteryDisplayLevel >= 6) - if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution + if (gBatteryDisplayLevel >= 6) State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain } else diff --git a/ui/status.c b/ui/status.c index 34c887c..4eb5528 100644 --- a/ui/status.c +++ b/ui/status.c @@ -187,54 +187,35 @@ void UI_DisplayStatus(const bool test_display) x += sizeof(BITMAP_USB_C); // BATTERY LEVEL indicator -#if 1 if (gBatteryDisplayLevel >= 2 && !gLowBattery) { line += x; memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); + #ifndef ENABLE_REVERSE_BAT_SYMBOL line += sizeof(BITMAP_BatteryLevel1); if (gBatteryDisplayLevel >= 2) memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 5) + if (gBatteryDisplayLevel >= 3) memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 7) + if (gBatteryDisplayLevel >= 4) memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 9) + if (gBatteryDisplayLevel >= 5) memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); #else if (gBatteryDisplayLevel >= 2) memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 5) + if (gBatteryDisplayLevel >= 3) memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 7) + if (gBatteryDisplayLevel >= 4) memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 9) + if (gBatteryDisplayLevel >= 5) memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); #endif } else if (gLowBatteryBlink == 1) memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); -#else -// UI_DisplayBattery(gBatteryDisplayLevel); - - line += x; - if (gBatteryDisplayLevel > 0) - { - const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11; - memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); - #ifdef ENABLE_REVERSE_BAT_SYMBOL - for (uint8_t i = 0; i < level; i++) - line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101; - #else - for (uint8_t i = 0; i < level; i++) - line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101; - #endif - } - else - memset(line, 0, sizeof(BITMAP_BatteryLevel1)); -#endif // **************