Skip to content
Snippets Groups Projects
Verified Commit f9c0be39 authored by minute's avatar minute
Browse files

kbd fw: use snprintf; use fw version from environment/build

parent 5ebd40d2
No related branches found
Tags 20250106
No related merge requests found
Pipeline #3310 passed
#!/bin/bash
export PICO_SDK_PATH=/usr/src/pico-sdk
export MNTRE_FIRMWARE_VERSION=$(date +%Y%m%d)
mkdir -p build
cd build
......
......@@ -7,8 +7,6 @@
#ifndef _KEYBOARD_H_
#define _KEYBOARD_H_
#define PREF_HID_FW_REV "PREFHID20240416"
void reset_keyboard_state(void);
void led_set(uint32_t rgb);
......
......@@ -880,7 +880,7 @@ void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_
// uncomment for debugging
/*char repinfo[64];
sprintf(repinfo, "cm: %c%c%c%c 4: %d sz: %d", cmd[0],cmd[1],cmd[2],cmd[3], cmd[4], bufsize);
snprintf(repinfo, sizeof(repinfo)-1, "cm: %c%c%c%c 4: %d sz: %d", cmd[0],cmd[1],cmd[2],cmd[3], cmd[4], bufsize);
gfx_poke_str(0, 0, repinfo);
gfx_flush();*/
......
......@@ -127,10 +127,12 @@ int remote_try_command(const char* cmd, int print_response) {
}
int remote_get_status(void) {
gfx_clear();
char tmp[20];
snprintf(tmp, sizeof(tmp)-1, "PREF1HID%d", MNTRE_FIRMWARE_VERSION);
gfx_clear();
gfx_poke_cstr(0, 2, "MNT Pocket Reform HID");
gfx_poke_cstr(0, 3, PREF_HID_FW_REV);
gfx_poke_cstr(0, 3, tmp);
gfx_on();
gfx_flush();
......@@ -191,22 +193,22 @@ int remote_get_voltages(int quiet) {
gfx_clear();
char str[32];
sprintf(str,"[] %.1f %s",voltages[0],bat_gauge);
snprintf(str,31, "[] %.1f %s",voltages[0],bat_gauge);
insert_bat_icon(str,0,voltages[0]);
gfx_poke_str(0,0,str);
sprintf(str,"[] %.1f %s",voltages[1],power_str);
snprintf(str,31,"[] %.1f %s",voltages[1],power_str);
insert_bat_icon(str,0,voltages[1]);
gfx_poke_str(0,1,str);
if (bat_amps>=0) {
sprintf(str," %2.3fA",bat_amps);
snprintf(str,31," %2.3fA",bat_amps);
} else {
sprintf(str," %2.2fA",bat_amps);
snprintf(str,31," %2.2fA",bat_amps);
}
gfx_poke_str(0,2,str);
sprintf(str," %2.2fV",bat_volts);
snprintf(str,31," %2.2fV",bat_volts);
gfx_poke_str(0,3,str);
gfx_flush();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment