Add repeater protocol and device firmware features

This commit is contained in:
Lars Nolden
2026-09-21 12:30:50 +02:00
parent 73d3ddf00c
commit a11a4b3b89
41 changed files with 7791 additions and 228 deletions
+55
View File
@@ -0,0 +1,55 @@
// Host-side visual check of the 5x7 font: renders representative UI text
// as ASCII art so the glyph table can be reviewed without hardware, and
// asserts basic structural invariants.
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "font5x7.h"
static void render_line(const char *text)
{
char rows[FONT5X7_H][128];
int cols = 0;
memset(rows, 0, sizeof(rows));
for (const char *p = text; *p && cols + 6 < 120; p++) {
unsigned c = (unsigned char)*p;
if (c < FONT5X7_FIRST || c > FONT5X7_LAST) c = '?';
const uint8_t *g = font5x7[c - FONT5X7_FIRST];
for (int x = 0; x < FONT5X7_W; x++) {
for (int y = 0; y < FONT5X7_H; y++) {
rows[y][cols + x] = (g[x] >> y) & 1 ? '#' : ' ';
}
}
for (int y = 0; y < FONT5X7_H; y++) rows[y][cols + 5] = ' ';
cols += 6;
}
for (int y = 0; y < FONT5X7_H; y++) {
rows[y][cols] = 0;
printf("|%s|\n", rows[y]);
}
printf("\n");
}
int main(void)
{
// Every printable glyph except space must have at least one pixel.
for (int c = FONT5X7_FIRST + 1; c <= FONT5X7_LAST; c++) {
int bits = 0;
for (int x = 0; x < FONT5X7_W; x++) {
const uint8_t *g = font5x7[c - FONT5X7_FIRST];
for (int y = 0; y < FONT5X7_H; y++) bits += (g[x] >> y) & 1;
assert((g[x] & 0x80) == 0); // 7 rows only
}
assert(bits > 0);
}
render_line("WMBUS RPT 868.95 C1");
render_line("RX 389 TX 381 OK");
render_line("DUTY [####-] 0.09%");
render_line("0123456789 +-/:=.#%");
render_line("ABCDEFGHIJKLM");
render_line("NOPQRSTUVWXYZ");
puts("font render test: PASS (inspect art above)");
return 0;
}