Skip to content

Commit c09a720

Browse files
committed
Use board API for reboot/name; tidy httpd
Add a board::Reboot wrapper in GD32 hal and switch remoteconfig code to use board.h instead of hal.h/hal_boardinfo.h. Update reboot calls to use board::Reboot and board name lookup to board::BoardName; also bump copyright year in json_getversion.cpp. Remove some pre-reboot display calls in RemoteConfig::HandleReboot. Perform widespread stylistic cleanup and minor refactors in the HTTP daemon handler (brace/whitespace normalization, snprintf formatting, and small function formatting changes) and adjust JSON action reboot handling to call board::Reboot.
1 parent 9156071 commit c09a720

5 files changed

Lines changed: 118 additions & 235 deletions

File tree

lib-hal/src/gd32/hal_reboot.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,9 @@ bool Reboot() {
6767
return true;
6868
}
6969
} // namespace hal
70+
71+
namespace board {
72+
bool Reboot() {
73+
return hal::Reboot();
74+
}
75+
} // namespace board

lib-remoteconfig/src/http/json_action.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "display.h"
2828
#include "hal_statusled.h"
29-
#include "hal.h"
29+
#include "board.h"
3030
#include "json/json_key.h"
3131
#include "json/json_parser.h"
3232

@@ -49,14 +49,11 @@ static void SetIdentify(const char* val, uint32_t len) {
4949
// TODO (a) Subject for deletion
5050
static void SetReboot(const char* val, uint32_t len) {
5151
if (len != 1) return;
52-
53-
if (val[0] != '0') hal::Reboot();
52+
if (val[0] != '0') board::Reboot();
5453
}
5554

5655
static constexpr json::SimpleKey kDisplay{"display", 7, Fnv1a32("display", 7)};
57-
5856
static constexpr json::SimpleKey kIdentify{"identify", 8, Fnv1a32("identify", 8)};
59-
6057
static constexpr json::SimpleKey kReboot{"reboot", 6, Fnv1a32("reboot", 6)};
6158

6259
static constexpr json::Key kActionKeys[] = {json::MakeKey(SetDisplay, kDisplay), json::MakeKey(SetIdentify, kIdentify), json::MakeKey(SetReboot, kReboot)};

lib-remoteconfig/src/http/json_getversion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @file json_getversion.cpp
33
*/
4-
/* Copyright (C) 2025 by Arjan van Vught mailto:info@gd32-dmx.org
4+
/* Copyright (C) 2025-2026 by Arjan van Vught mailto:info@gd32-dmx.org
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,7 @@
2525
#include <cstdint>
2626
#include <cstdio>
2727

28-
#include "hal_boardinfo.h"
28+
#include "board.h"
2929
#include "firmwareversion.h"
3030

3131
namespace json {
@@ -37,7 +37,7 @@ uint32_t GetVersion(char* out_buffer, uint32_t out_buffer_size) {
3737
"{\"version\":\"%.*s\",\"board\":\"%s\",\"build\":{\"date\":\"%.*s\",\"time\":\"%.*s\"}}",
3838
firmwareversion::length::kSoftwareVersion,
3939
version->software_version,
40-
hal::BoardName(hw_text_length),
40+
board::BoardName(hw_text_length),
4141
firmwareversion::length::kGccDate, version->build_date,
4242
firmwareversion::length::kGccTime, version->build_time));
4343
return kLength;

0 commit comments

Comments
 (0)