Skip to content

Commit

Permalink
Node scan now can go directly to firmware load for specific node
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Nov 20, 2024
1 parent a99a1d8 commit 7a523ed
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 89 deletions.
65 changes: 33 additions & 32 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,46 @@
{
"name": "Linux",
"includePath": [
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${VSCP_ROOT}/src/**",
"${workspaceFolder}/",
"${workspaceFolder}/src/",
"${workspaceFolder}/common/",
"${workspaceFolder}/common/third_party/",
"${workspaceFolder}/common/third_party/nlohmann/",
"${workspaceFolder}/common/third_party/spdlog-1.9.2/include",
"${workspaceFolder}/common/third_party/sqlite3-3.35.4/",
"${workspaceFolder}/common/third_party/duktape-2.6.0/",
"${workspaceFolder}/common/third_party/fastpbkdf2-1.0.0/",
"${workspaceFolder}/../vscp/src/common",
"${workspaceFolder}/../vscp/src/vscp/common"
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${VSCP_ROOT}/src/**",
"${workspaceFolder}/",
"${workspaceFolder}/src/",
"${workspaceFolder}/common/",
"${workspaceFolder}/common/third_party/",
"${workspaceFolder}/common/third_party/nlohmann/",
"${workspaceFolder}/common/third_party/spdlog-1.9.2/include",
"${workspaceFolder}/common/third_party/sqlite3-3.35.4/",
"${workspaceFolder}/common/third_party/duktape-2.6.0/",
"${workspaceFolder}/common/third_party/fastpbkdf2-1.0.0/",
"${workspaceFolder}/../vscp/src/common",
"${workspaceFolder}/../vscp/src/vscp/common",
"/home/akhe/Qt/6.8.0/gcc_64/include"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"intelliSenseMode": "gcc-x64",
"browse": {
"path": [
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${VSCP_ROOT}/src/**",
"${workspaceFolder}/src/",
"${workspaceFolder}/common/",
"${workspaceFolder}/common/third_party/",
"${workspaceFolder}/common/third_party/nlohmann/",
"${workspaceFolder}/common/third_party/spdlog-1.9.2/include",
"${workspaceFolder}/common/third_party/sqlite3-3.35.4/",
"${workspaceFolder}/common/third_party/duktape-2.6.0/",
"${workspaceFolder}/common/third_party/fastpbkdf2-1.0.0/",
"${workspaceFolder}/../vscp/src/common",
"${workspaceFolder}/../vscp/src/vscp/common"
"path": [
"/usr/local/include",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${VSCP_ROOT}/src/**",
"${workspaceFolder}/src/",
"${workspaceFolder}/common/",
"${workspaceFolder}/common/third_party/",
"${workspaceFolder}/common/third_party/nlohmann/",
"${workspaceFolder}/common/third_party/spdlog-1.9.2/include",
"${workspaceFolder}/common/third_party/sqlite3-3.35.4/",
"${workspaceFolder}/common/third_party/duktape-2.6.0/",
"${workspaceFolder}/common/third_party/fastpbkdf2-1.0.0/",
"${workspaceFolder}/../vscp/src/common",
"${workspaceFolder}/../vscp/src/vscp/common"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "/usr/bin/clang",
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17",
"configurationProvider": "ms-vscode.cmake-tools"
Expand Down
42 changes: 36 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,39 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch lldb",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/vscp-works-qt",
"args": [],
"preLaunchTask": "build",
},
{
"name": "(gdb) Launch X",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/vscp-works-qt",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},

{
"name": "(gdb) Launch",
"type": "cppdbg",
Expand All @@ -15,15 +48,16 @@
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"visualizerFile": "/home/akhe/.config/Code/User/workspaceStorage/b3a88788bb1e8a32eb6392485a993de5/tonka3000.qtvsctools/qt.natvis.xml",
"logging": { "engineLogging": true, "trace": true, "traceResponse": true },
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build",
"visualizerFile": "/home/akhe/.config/Code/User/workspaceStorage/b3a88788bb1e8a32eb6392485a993de5/tonka3000.qtvsctools/qt.natvis.xml"
},
{
"name": "g++ build and debug active file",
Expand Down Expand Up @@ -52,11 +86,7 @@
"request": "launch",
"name": "Debug portfile(s)",
"cmakeDebugType": "external",
<<<<<<< HEAD
"pipeName": "/tmp/vcpkg_ext_portfile_dbg",
=======
"pipeName": "\\\\.\\pipe\\vcpkg_ext_portfile_dbg",
>>>>>>> 99063577d2c6f0b876be4ba772a602728c9740bf
"preLaunchTask": "Debug vcpkg commands"
}
]
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@
],
"cSpell.language": "sv,en",
"cSpell.words": [
"MQTT"
"Grodans",
"Hedman",
"MQTT",
"Paradis"
],
"cmake.clearOutputBeforeBuild": false,
"cmake.configureEnvironment": {
Expand Down
39 changes: 7 additions & 32 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"isDefault": true
},
{
"taskName": "build",
"taskName": "make",
"label": "build",
"type": "shell",
"command": "cd build; make -j4 -Wall",
"command": "cd build; make -j4 -Wall ",
"args": [],
"group": "build",
"problemMatcher": "$gcc",
"label": "build"
"problemMatcher": "$gcc"
},
{
"taskName": "clean & build all",
Expand Down Expand Up @@ -47,7 +47,7 @@
{
"taskName": "Clean & build all 6.8.0",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.8.0/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/6.8.0/gcc_64 .. ; make -j4",
"command": "rm -rf build; mkdir build; cd build; export CMAKE_PREFIX_PATH=~/Qt/6.8.0/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/6.8.0/gcc_64 .. ; make -j4 -Wall",
"args": [],
"group": "build",
"problemMatcher": {
Expand All @@ -70,7 +70,7 @@
{
"taskName": "Clean & build all 6.7.3",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.7.3/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/7.3.0/gcc_64 .. ; make -j4",
"command": "rm -rf build; mkdir build; cd build; export CMAKE_PREFIX_PATH=~/Qt/6.7.3/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/7.3.0/gcc_64 .. ; make -j4 -Wall",
"args": [],
"group": "build",
"problemMatcher": {
Expand All @@ -93,7 +93,7 @@
{
"taskName": "Clean & build all 6.5.3",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/6.5.3/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/6.5.3/gcc_64 .. ; make -j4",
"command": "rm -rf build; mkdir build; cd build; export CMAKE_PREFIX_PATH=~/Qt/6.5.3/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/6.5.3/gcc_64 .. ; make -j4 -Wall",
"args": [],
"group": "build",
"problemMatcher": {
Expand All @@ -113,31 +113,6 @@
},
"label": "Clean & build all 6.5.3"
},
{
"taskName": "Clean & build all 5.15.2",
"type": "shell",
"command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug -DQt6_DIR=~/Qt/5.15.2/gcc_64 .. ; make -j4 -Wall",
"args": [],
"group": {
"kind": "build"
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"label": "Clean & build all 5.15.2"
},
{
"type": "shell",
"label": "g++ build active file",
Expand Down
Binary file added images/bootloader_watermark.xcf
Binary file not shown.
Binary file added images/canal_watermark.xcf
Binary file not shown.
20 changes: 15 additions & 5 deletions src/bootloaderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ CWizardPageNickname::CWizardPageNickname(QWidget* parent, CVscpClient* vscpClien
{
vscpworks* pworks = (vscpworks*)QCoreApplication::instance();
m_vscpClient = vscpClient;

m_nickname = 1;
}

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -114,7 +116,8 @@ CWizardPageNickname::initializePage(void)
"to set node id\n\n"));
label->setWordWrap(true);

QLineEdit* pNodeId = new QLineEdit("0x01");
QString str = QString::number(m_nickname);
QLineEdit* pNodeId = new QLineEdit(QString("0x%1").arg(m_nickname, 2, 16, QLatin1Char('0')));
QCheckBox* pSetInBootMode = new QCheckBox("Remote device is already in bootmode");
pNodeId->setMaximumWidth(100);
// pNodeIdSpinBox->setMinimum(1);
Expand Down Expand Up @@ -670,6 +673,7 @@ CWizardPageLoadMdf::validatePage(void)
str += " Model: ";
str += mdf.getModuleModel().c_str();
setField("boot.firmware.devicename", str);
QApplication::restoreOverrideCursor();
}
} break;
#endif
Expand Down Expand Up @@ -726,7 +730,7 @@ void
CWizardPageFirmware::initializePage(void)
{
QString str;
setTitle("Select firmare to upload to device");
setTitle("Select firmware to upload to device");

QLabel* label = new QLabel("Select the firmware you want to upload to the remote device. "
"You can use a local file or you can use one of the files listed "
Expand All @@ -747,6 +751,7 @@ CWizardPageFirmware::initializePage(void)
QLabel* labelBootloadDeviceCode = new QLabel("Current firmware device code: " +
field("boot.firmware.device.code").toString());
m_chkLocalFile = new QCheckBox("Use local firmware file");
m_chkLocalFile->setStyleSheet("color: rgb(129, 61, 156);");
m_btnSelectFirmware = new QPushButton("Select firmware file");
m_editFirmwareFile = new QLineEdit("No firmware file selected");

Expand All @@ -757,6 +762,7 @@ CWizardPageFirmware::initializePage(void)
layout->addWidget(labelVer);
layout->addWidget(labelBootloadAlgorithm);
layout->addWidget(labelBootloadDeviceCode);
layout->addSpacing(30);
layout->addWidget(m_chkLocalFile);
layout->addWidget(m_btnSelectFirmware);
layout->addWidget(m_editFirmwareFile);
Expand Down Expand Up @@ -841,6 +847,10 @@ CWizardPageFirmware::isComplete(void) const
return true;
}

///////////////////////////////////////////////////////////////////////////////
// write_data
//

static size_t
write_data(void* ptr, size_t size, size_t nmemb, FILE* stream)
{
Expand All @@ -862,8 +872,8 @@ CWizardPageFirmware::validatePage(void)
}

/*!
Open file selction dialog if local file is checked
and filname is nill
Open file selection dialog if local file is checked
and filename is nill
*/
if (m_chkLocalFile->isChecked() && !m_editFirmwareFile->text().trimmed().size()) {
QString path = QFileDialog::getOpenFileName(this,
Expand Down Expand Up @@ -1109,7 +1119,7 @@ CWizardPageFlash::flashDevice(void)
guid.setNicknameID(vscp_readStringValue(field("boot.nickname").toString().toStdString()));
using namespace std::placeholders;
// auto callback = std::bind(&CWizardPageLoadMdf::statusCallback, this, _1, _2);
// lambda version for reference
// lambda version for reference
auto callback = [this](auto a, auto b) { this->statusCallback(a, b); };
CBootDevice_PIC1 boot(m_vscpClient, vscp_readStringValue(field("boot.nickname").toString().toStdString()), callback);
addStatusMessage("Hex file path: " + field("boot.firmware.path").toString());
Expand Down
8 changes: 7 additions & 1 deletion src/bootloaderwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,15 @@ class CWizardPageNickname : public QWizardPage {
*/
int nextId(void) const;

/// Set initial nickname
void setNickname(uint16_t nickname) { m_nickname = nickname; }

private:
/// A pointer to a VSCP Client
CVscpClient* m_vscpClient;

// Default
uint16_t m_nickname;
};

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -343,7 +349,7 @@ class CWizardPageFlash : public QWizardPage {

/*!
Add a status message
@param str Statusmessage to add. Not added if zero length
@param str Status message to add. Not added if zero length
*/
void addStatusMessage(const QString& str);

Expand Down
Loading

0 comments on commit 7a523ed

Please sign in to comment.