feat(vesc): extend motor diagnostics, configuration and transport recovery

Add firmware and extension catalogues, configuration transactions, sample review and QML diagnostics. Preserve explicit authority, bounded retries and stop recovery in motor transport.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:09:59 +03:00
parent 115476d2e6
commit f32c7b400b
186 changed files with 21197 additions and 339 deletions
+25
View File
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include "config_export.h"
#include <QtEndian>
// Transport/file bounds and STM32 vector sanity, not a signature or a board-ID
// proof. Hardware and target version remain operator declarations for raw BIN.
static QJsonObject inspectFirmwareImage(const QByteArray &raw, const QString &kind) {
require(kind == "firmware" || kind == "bootloader", "Unknown image kind");
const int bound = kind == "bootloader" ? 65536 : 2 * 1024 * 1024;
require(raw.size() >= 256 && raw.size() <= bound, "Image size outside the supported bound");
// This upload profile accepts raw STM32 BIN only. Encoded/compressed/Intel
// HEX files must be deliberately converted by their owning Tool first.
const auto sp = qFromLittleEndian<quint32>(raw.constData());
const auto reset = qFromLittleEndian<quint32>(raw.constData() + 4);
require(sp >= 0x20000000 && sp <= 0x20040000 && (sp & 3) == 0,
"Raw STM32 image has an invalid initial stack pointer");
require((reset & 1) && reset >= 0x08000001 && reset < 0x08200000,
"Raw STM32 image has an invalid reset vector");
// fwUpload owns normalization. Require that it leaves this raw image intact
// so the reviewed hash describes exactly the bytes passed to the uploader.
require(Packet::crc16(reinterpret_cast<const unsigned char *>(raw.constData()+6), raw.size()-6) != qFromBigEndian<quint16>(raw.constData()+4), "Wrapped firmware is not a raw BIN image");
return {{"kind", kind}, {"bytes", raw.size()}, {"sha256", sha256(raw)},
{"format", "raw-stm32-bin"}, {"board_identity_embedded", false}};
}