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
+37
View File
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QMouseEvent>
#include <QKeyEvent>
#include <QWheelEvent>
#include <QInputMethodEvent>
#include <QSocketNotifier>
static void qmlInput(QQuickWindow &window,const QJsonArray &events) {
require(events.size()<=32,"Too many input events");
for(const auto &value:events){
require(value.isObject(),"Invalid input event");auto e=value.toObject();auto kind=e.value("kind").toString();
if(kind=="down" || kind=="up" || kind=="move" || kind=="wheel") {
double x=e.value("x").toDouble(-1),y=e.value("y").toDouble(-1);
require(std::isfinite(x)&&std::isfinite(y)&&x>=0&&x<640&&y>=0&&y<480,"Invalid input coordinates");
QPointF p(x,y);
if(kind=="wheel"){
int delta=e.value("delta").toInt();require(std::abs(delta)<=1200,"Invalid wheel input");
QWheelEvent ev(p,p,QPoint(),QPoint(0,delta),Qt::NoButton,Qt::NoModifier,Qt::NoScrollPhase,false);QCoreApplication::sendEvent(&window,&ev);
}else{
auto type=kind=="down"?QEvent::MouseButtonPress:kind=="up"?QEvent::MouseButtonRelease:QEvent::MouseMove;
QMouseEvent ev(type,p,p,p,kind=="move"?Qt::NoButton:Qt::LeftButton,kind=="up"?Qt::NoButton:Qt::LeftButton,Qt::NoModifier);
QCoreApplication::sendEvent(&window,&ev);
}
}else if(kind=="text"){
auto text=e.value("text").toString();require(text.size()<=1024&&!text.contains(QChar(0)),"Invalid text input");
QInputMethodEvent ev;ev.setCommitString(text);
auto focus=window.activeFocusItem();if(focus)QCoreApplication::sendEvent(focus,&ev);
}else if(kind=="key"){
const QMap<QString,int> keys{{"Enter",Qt::Key_Return},{"Tab",Qt::Key_Tab},{"Backspace",Qt::Key_Backspace},{"Delete",Qt::Key_Delete},{"ArrowLeft",Qt::Key_Left},{"ArrowRight",Qt::Key_Right},{"ArrowUp",Qt::Key_Up},{"ArrowDown",Qt::Key_Down},{"Home",Qt::Key_Home},{"End",Qt::Key_End},{"Escape",Qt::Key_Escape},{"SelectAll",Qt::Key_A}};
auto name=e.value("key").toString();require(keys.contains(name),"Unsupported QML key");
auto modifiers=name=="SelectAll"?Qt::ControlModifier:Qt::NoModifier;
QKeyEvent down(QEvent::KeyPress,keys[name],modifiers),up(QEvent::KeyRelease,keys[name],modifiers);
QCoreApplication::sendEvent(&window,&down);QCoreApplication::sendEvent(&window,&up);
}else throw std::runtime_error("Unknown QML input event");
}
}