rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
battery_screen.h File Reference

The pack: what each cell is doing relative to the others. More...

#include <stdbool.h>
#include "gfx.h"
#include "ui_screen.h"

Go to the source code of this file.

Data Structures

struct  battery_state_t
 What the balance lead says of a pack. More...

Macros

#define BATTERY_CELLS_MAX   14
 The most cells a pack is drawn with.

Functions

void battery_invalidate (void)
const ui_screen_t * battery_screen (void)
 The BATTERY screen.
void battery_screen_set (const battery_state_t *b)
 What the balance lead says. NULL, or valid false, means nothing is on.
float battery_screen_spread_mv (void)
 The widest gap between any two cells.
const gfx_font_t * battery_screen_cells_font (int cells)
 The face of the cells row under the plot for a pack of cells: 12 x 24 while a voltage ("3.81") fits its cell's slot, else the 10 x 20 face, else 8 x 16.
int battery_screen_text_lines (const char *text, bool note)
 The lines text takes in the right card's column: the verdict's reason in the 12 x 24 face (the card shows two lines), or a part of the note in the 10 x 20 face.

Detailed Description

The pack: what each cell is doing relative to the others.

SPDX-License-Identifier: MIT

Function Documentation

◆ battery_invalidate()

void battery_invalidate ( void )

Drop the cached chrome, so the next frame repaints it.

◆ battery_screen()

const ui_screen_t * battery_screen ( void )

The BATTERY screen.

Returns
The screen.

◆ battery_screen_cells_font()

const gfx_font_t * battery_screen_cells_font ( int cells)

The face of the cells row under the plot for a pack of cells: 12 x 24 while a voltage ("3.81") fits its cell's slot, else the 10 x 20 face, else 8 x 16.

Parameters
cellsThe pack's cells; under 1 counts as 1.
Returns
The face.

◆ battery_screen_set()

void battery_screen_set ( const battery_state_t * b)

What the balance lead says. NULL, or valid false, means nothing is on.

Parameters
bThe pack, copied; NULL clears it.

◆ battery_screen_spread_mv()

float battery_screen_spread_mv ( void )

The widest gap between any two cells.

Returns
Millivolts; 0 with no pack.

◆ battery_screen_text_lines()

int battery_screen_text_lines ( const char * text,
bool note )

The lines text takes in the right card's column: the verdict's reason in the 12 x 24 face (the card shows two lines), or a part of the note in the 10 x 20 face.

Parameters
textThe text, as the screen shows it.
noteTrue for the note's face, false for the reason's.
Returns
The lines, 0 for NULL or an empty text.