Compare commits

..

3 commits

Author SHA1 Message Date
Marcus Kida
700f18eea8 Release 0.12.0
Battery "Bars" display mode: a battery-shaped icon with up to four 25%
segments as a third status-bar option alongside % and voltage, with a
localised menu label. Docs (README, MANUAL, CHANGELOG) updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 08:58:10 +02:00
Marcus Kida
bc9e5cb655 Battery "Bars" mode: localise the menu label
Replace the hardcoded "Bars" literal with a proper language string
(battery_bars) so the Battery display-mode menu value is translated and
voice-prompt safe. German is "Balken"; other supported languages get an
appropriate term. Bumps LANGUAGE_TAG_VERSION for the struct change.

Menu value voice announcement routes through the language table like any
other option value (plays silence until the voice-prompt pack is rebuilt
with a recording); the battery-status announce key already speaks the
percentage in Bars mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-24 08:55:25 +02:00
Marcus Kida
4ec5cfdd4c Battery header: add "Bars" display mode
Extends the battery header setting from a %/V toggle into a 3-state
option (Percentage / Voltage / Bars), encoded across two option bits so
existing codeplugs keep reading as Percentage.

Bars renders a battery-shaped icon (outlined body + terminal nub) with
up to 4 segments, each representing 25% of charge, and blinks the fill
when the battery is low.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 11:06:24 +02:00
29 changed files with 148 additions and 19 deletions

View file

@ -9,6 +9,14 @@ single running list until the first versioned release.
_Nothing yet._
## 0.12.0
- **Battery "Bars" display** — a third battery status option in the top status
bar alongside **%** and **V**: a battery-shaped icon holding up to **four
segments**, each representing **25 %** of charge, with the fill blinking when
the battery is low. Cycle the mode with ◀/▶ at **Menu → Options → Display
Options → Battery**. The "Bars" menu label is localised (German: *Balken*).
## 0.11.0
- **CRT-style shut-off animation** — when powering off, the current screen

View file

@ -59,6 +59,18 @@ Optionally dims the backlight after inactivity to **100 / 50 / 30 / 15 %** of th
configured brightness (only in **Auto** backlight mode). Any activity restores full
brightness. Set it in **Menu → Options → Display Options → Screen Dim**.
### Battery display mode — 🟢 [FreeTRX]
The battery level in the top status bar can be shown three ways, cycled with
◀/▶ at **Menu → Options → Display Options → Battery**:
- **%** — remaining charge as a percentage.
- **V** — the measured battery voltage.
- **Bars** — a battery-shaped icon with up to **four segments**, each worth
**25 %** of charge. The fill blinks when the battery is low.
The **%** and **V** options are inherited from OpenGD77; **Bars** is the new
addition. In every mode the low-battery warning still blinks the reading.
### Shut-off animation — 🟢 [FreeTRX]
Powering off collapses whatever is on screen towards the middle — squeezed to a
line, then a dot — like an old CRT switching off, in place of the "Power Off"

View file

@ -5,9 +5,9 @@
#define _FREETRX_VERSION_H_
#define FREETRX_VERSION_MAJOR 0
#define FREETRX_VERSION_MINOR 11
#define FREETRX_VERSION_MINOR 12
#define FREETRX_VERSION_PATCH 0
#define FREETRX_VERSION "0.11.0"
#define FREETRX_VERSION "0.12.0"
#endif // _FREETRX_VERSION_H_

View file

@ -129,7 +129,7 @@ typedef enum
{
BIT_INVERSE_VIDEO = (SETTINGS_BITS_BANK_0 | (1 << 0)),
BIT_PTT_LATCH = (SETTINGS_BITS_BANK_0 | (1 << 1)),
BIT_UNUSED_2 = (SETTINGS_BITS_BANK_0 | (1 << 2)),
BIT_BATTERY_BARS_IN_HEADER = (SETTINGS_BITS_BANK_0 | (1 << 2)), // companion to BIT_BATTERY_VOLTAGE_IN_HEADER: encodes the "Bars" battery display mode
BIT_BATTERY_VOLTAGE_IN_HEADER = (SETTINGS_BITS_BANK_0 | (1 << 3)),
BIT_SETTINGS_UPDATED = (SETTINGS_BITS_BANK_0 | (1 << 4)),
BIT_TX_RX_FREQ_LOCK = (SETTINGS_BITS_BANK_0 | (1 << 5)),
@ -411,6 +411,20 @@ void settingsSetOptionBit(bitfieldOptions_t bit, bool set);
bool settingsIsOptionBitSetFromSettings(settingsStruct_t *sets, bitfieldOptions_t bit);
bool settingsIsOptionBitSet(bitfieldOptions_t bit);
// How the battery level is shown in the header. Encoded across two option bits
// (BIT_BATTERY_VOLTAGE_IN_HEADER / BIT_BATTERY_BARS_IN_HEADER) for backwards
// compatibility: an unset pair reads as PERCENTAGE, matching legacy behaviour.
typedef enum
{
BATTERY_UNIT_PERCENTAGE = 0,
BATTERY_UNIT_VOLTAGE,
BATTERY_UNIT_BARS,
NUM_BATTERY_UNIT_DISPLAY
} batteryUnitDisplay_t;
batteryUnitDisplay_t settingsGetBatteryUnitDisplay(void);
void settingsSetBatteryUnitDisplay(batteryUnitDisplay_t mode);
void settingsSetDirty(void);
void settingsSetVFODirty(void);
void settingsSaveIfNeeded(bool immediately);

View file

@ -345,6 +345,7 @@ const stringsTable_t catalanLanguage=
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Barres", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t croatianLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Trake", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t czechLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Pruhy", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t danishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Bjælker", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t dutchLanguage =
.sms_own_id_only = "Alleen mijn ID", // MaxLen: 16
.message_from = "Bericht van", // MaxLen: 16
.delete_message = "Bericht wissen?", // MaxLen: 16
.battery_bars = "Balken", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t englishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Bars", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t finnishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Palkit", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t frenchLanguage =
.sms_own_id_only = "Mon ID seul", // MaxLen: 16
.message_from = "Message de", // MaxLen: 16
.delete_message = "Suppr. message?", // MaxLen: 16
.battery_bars = "Barres", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t germanLanguage =
.sms_own_id_only = "Nur eigene ID", // MaxLen: 16
.message_from = "Nachricht von", // MaxLen: 16
.delete_message = "Nachricht lösch.", // MaxLen: 16
.battery_bars = "Balken", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t hungarianLanguage=
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Sávok", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t italianLanguage =
.sms_own_id_only = "Solo mio ID", // MaxLen: 16
.message_from = "Messaggio da", // MaxLen: 16
.delete_message = "Elimina msg?", // MaxLen: 16
.battery_bars = "Barre", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t japaneseLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Bar", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t polishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Paski", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t portuguesBrazilLanguage =
.sms_own_id_only = "Só meu ID", // MaxLen: 16
.message_from = "Mensagem de", // MaxLen: 16
.delete_message = "Apagar msg?", // MaxLen: 16
.battery_bars = "Barras", // MaxLen: 16
};
/*********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t portuguesLanguage =
.sms_own_id_only = "Só meu ID", // MaxLen: 16
.message_from = "Mensagem de", // MaxLen: 16
.delete_message = "Apagar msg?", // MaxLen: 16
.battery_bars = "Barras", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t romanianLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Bare", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t slovenianLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Stolpci", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t spanishLanguage =
.sms_own_id_only = "Solo mi ID", // MaxLen: 16
.message_from = "Mensaje de", // MaxLen: 16
.delete_message = "¿Borrar mensaje?", // MaxLen: 16
.battery_bars = "Barras", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t swedishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Staplar", // MaxLen: 16
};
/********************************************************************
*

View file

@ -345,6 +345,7 @@ const stringsTable_t turkishLanguage =
.sms_own_id_only = "My ID only", // MaxLen: 16
.message_from = "Message from", // MaxLen: 16
.delete_message = "Delete message?", // MaxLen: 16
.battery_bars = "Çubuklar", // MaxLen: 16
};
/********************************************************************
*

View file

@ -35,7 +35,7 @@
#else
#define LANGUAGE_TAG_MAGIC_NUMBER { 'G', 'D', '7', '7' }, { 'L', 'A', 'N', 'G' } // Never change this tag.
#endif
#define LANGUAGE_TAG_VERSION { 0x00, 0x00, 0x00, 0x06 } // Bump the version each time the language struct is changed
#define LANGUAGE_TAG_VERSION { 0x00, 0x00, 0x00, 0x07 } // Bump the version each time the language struct is changed
typedef struct
{
@ -353,6 +353,7 @@ typedef struct
const char sms_own_id_only[LANGUAGE_TEXTS_LENGTH];
const char message_from[LANGUAGE_TEXTS_LENGTH];
const char delete_message[LANGUAGE_TEXTS_LENGTH];
const char battery_bars[LANGUAGE_TEXTS_LENGTH]; // "Bars" battery header display mode
} stringsTable_t;
#endif // _OPENGD77_UILANGUAGE_H_

View file

@ -619,6 +619,27 @@ void settingsSetScreenDimLevel(uint8_t level)
settingsSetOptionBit(BIT_SCREEN_DIM_2, ((level & 4) != 0));
}
// Battery header display mode is stored across two option bits so existing
// codeplugs (both bits clear) keep reading as BATTERY_UNIT_PERCENTAGE.
batteryUnitDisplay_t settingsGetBatteryUnitDisplay(void)
{
if (settingsIsOptionBitSet(BIT_BATTERY_BARS_IN_HEADER))
{
return BATTERY_UNIT_BARS;
}
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
{
return BATTERY_UNIT_VOLTAGE;
}
return BATTERY_UNIT_PERCENTAGE;
}
void settingsSetBatteryUnitDisplay(batteryUnitDisplay_t mode)
{
settingsSetOptionBit(BIT_BATTERY_VOLTAGE_IN_HEADER, (mode == BATTERY_UNIT_VOLTAGE));
settingsSetOptionBit(BIT_BATTERY_BARS_IN_HEADER, (mode == BATTERY_UNIT_BARS));
}
void settingsSetDirty(void)
{
settingsDirty = true;

View file

@ -314,15 +314,19 @@ static void updateScreen(bool isFirstRun)
#if ! defined(PLATFORM_MD9600)
case DISPLAY_BATTERY_UNIT_IN_HEADER:
leftSide = currentLanguage->battery;
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
switch (settingsGetBatteryUnitDisplay())
{
rightSideUnitsPrompt = PROMPT_VOLTS;
rightSideUnitsStr = "V";
}
else
{
rightSideUnitsPrompt = PROMPT_PERCENT;
rightSideUnitsStr = "%";
case BATTERY_UNIT_VOLTAGE:
rightSideUnitsPrompt = PROMPT_VOLTS;
rightSideUnitsStr = "V";
break;
case BATTERY_UNIT_BARS:
rightSideConst = currentLanguage->battery_bars;
break;
default: // BATTERY_UNIT_PERCENTAGE
rightSideUnitsPrompt = PROMPT_PERCENT;
rightSideUnitsStr = "%";
break;
}
break;
#endif
@ -705,9 +709,12 @@ static void handleEvent(uiEvent_t *ev)
#if ! defined(PLATFORM_MD9600)
case DISPLAY_BATTERY_UNIT_IN_HEADER:
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER) == false)
{
settingsSetOptionBit(BIT_BATTERY_VOLTAGE_IN_HEADER, true);
batteryUnitDisplay_t batteryUnit = settingsGetBatteryUnitDisplay();
if (batteryUnit < (NUM_BATTERY_UNIT_DISPLAY - 1))
{
settingsSetBatteryUnitDisplay(batteryUnit + 1);
}
}
break;
#endif
@ -928,9 +935,12 @@ static void handleEvent(uiEvent_t *ev)
#if ! defined(PLATFORM_MD9600)
case DISPLAY_BATTERY_UNIT_IN_HEADER:
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
{
settingsSetOptionBit(BIT_BATTERY_VOLTAGE_IN_HEADER, false);
batteryUnitDisplay_t batteryUnit = settingsGetBatteryUnitDisplay();
if (batteryUnit > BATTERY_UNIT_PERCENTAGE)
{
settingsSetBatteryUnitDisplay(batteryUnit - 1);
}
}
break;
#endif
@ -1182,6 +1192,7 @@ static void exitCallback(void *data)
#endif
#if ! defined(PLATFORM_MD9600)
BIT_BATTERY_VOLTAGE_IN_HEADER,
BIT_BATTERY_BARS_IN_HEADER,
#endif
#if defined(HAS_SOFT_VOLUME)
BIT_VISUAL_VOLUME,

View file

@ -1897,7 +1897,7 @@ void uiUtilityRenderHeader(bool isVFODualWatchScanning, bool isVFOSweepScanning,
UNUSED_PARAMETER(forceBatteryDisplay);
#endif
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
if (settingsGetBatteryUnitDisplay() == BATTERY_UNIT_VOLTAGE)
{
getBatteryVoltage(&volts, &mvolts);
@ -1911,6 +1911,7 @@ void uiUtilityRenderHeader(bool isVFODualWatchScanning, bool isVFOSweepScanning,
}
else
{
// Both the percentage and bars display modes need the battery percentage.
batteryPercentage = getBatteryPercentage();
if (batteryPercentage < 100)
@ -2207,7 +2208,9 @@ void uiUtilityRenderHeader(bool isVFODualWatchScanning, bool isVFOSweepScanning,
else
#endif
{
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
batteryUnitDisplay_t batteryUnit = settingsGetBatteryUnitDisplay();
if (batteryUnit == BATTERY_UNIT_VOLTAGE)
{
int16_t xV = (DISPLAY_SIZE_X - ((4 * 6) + 3));
@ -2219,6 +2222,41 @@ void uiUtilityRenderHeader(bool isVFODualWatchScanning, bool isVFOSweepScanning,
snprintf(buffer, SCREEN_LINE_BUFFER_SIZE, "%1dV", mvolts);
displayPrintCore(xV + (6 * 2) + 3, DISPLAY_Y_POS_HEADER, buffer, (apoEnabled ? FONT_SIZE_1_BOLD : FONT_SIZE_1), TEXT_ALIGN_LEFT, ((batteryIsLow ? scanBlinkPhase : false)));
}
else if (batteryUnit == BATTERY_UNIT_BARS)
{
// Battery-shaped icon, right-aligned in the header: an outlined body with a
// terminal nub, holding up to 4 segments each representing 25% of charge.
const int16_t bodyW = 24;
const int16_t bodyH = 7;
const int16_t nubW = 2;
const int16_t nubH = 3;
const int16_t barW = 4;
const int16_t barGap = 1;
int16_t bx = (DISPLAY_SIZE_X - bodyW - nubW);
int16_t by = DISPLAY_Y_POS_HEADER;
// 0..4 filled segments (rounded to the nearest quarter).
int16_t filledBars = ((batteryPercentage + 12) / 25);
if (filledBars > 4)
{
filledBars = 4;
}
else if (filledBars < 0)
{
filledBars = 0;
}
// Body outline and terminal nub stay solid; only the fill blinks when low.
// NOTE: displayDrawRect uses isInverted==true for foreground (visible), whereas
// displayFillRect is the opposite (isInverted==false draws the foreground).
displayDrawRect(bx, by, bodyW, bodyH, true);
displayFillRect(bx + bodyW, by + ((bodyH - nubH) / 2), nubW, nubH, false);
for (int16_t b = 0; b < filledBars; b++)
{
displayFillRect(bx + 2 + (b * (barW + barGap)), by + 2, barW, (bodyH - 4), ((batteryIsLow ? scanBlinkPhase : false)));
}
}
else
{
snprintf(buffer, SCREEN_LINE_BUFFER_SIZE, "%d%%", batteryPercentage);
@ -3149,12 +3187,13 @@ void announceItemWithInit(bool init, voicePromptItem_t item, audioPromptThreshol
break;
case PROMPT_SEQUENCE_BATTERY:
if (settingsIsOptionBitSet(BIT_BATTERY_VOLTAGE_IN_HEADER))
if (settingsGetBatteryUnitDisplay() == BATTERY_UNIT_VOLTAGE)
{
announceBatteryVoltage();
}
else
{
// Bars mode maps to a charge percentage, so announce it as a percentage.
announceBatteryPercentage();
}
break;

View file

@ -54,6 +54,9 @@ FreeTRX keeps OpenGD77's core (DMR/FM, hotspot, CPS compatibility) and adds:
Channel quick menu, no PC/CPS required (see [Managing channels](#managing-channels-on-the-radio)).
- **CRT-style shut-off animation** — the current screen collapses to a line and
then a dot, like an old CRT switching off (replaces the "Power Off" message).
- **Battery bars display** — a third battery status option alongside % and
voltage: a battery-shaped icon with up to four 25 % segments (Display Options →
Battery).
- **DMR reliability fix** — resolves a hard-fault (freeze needing a battery pull)
on the DMR path that affected recent self-built OpenGD77 revisions.