Skip to content

Commit 57f501c

Browse files
Added VSCP_ERROR_INTERFACE
1 parent 877deb0 commit 57f501c

14 files changed

+62
-40
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ SpaceAfterCStyleCast: true
2222
AllowShortFunctionsOnASingleLine: Inline
2323
BreakBeforeBinaryOperators: None
2424
#AllowShortBlocksOnASingleLine: true
25+
SortIncludes: false
2526

2627
# google-readability-braces-around-statements

cspell.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": "0.2",
3+
"ignorePaths": [],
4+
"dictionaryDefinitions": [],
5+
"dictionaries": [],
6+
"words": [],
7+
"ignoreWords": [],
8+
"import": []
9+
}

database

20 KB
Binary file not shown.
Binary file not shown.

src/vscp/common/vscp-bootdevice-pic1.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
// #include <spdlog/sinks/stdout_color_sinks.h>
4141
#include <spdlog/spdlog.h>
4242

43+
#include <iomanip>
4344
#include <iostream>
44-
#include <iomanip>
45-
#include <sstream>
45+
#include <sstream>
4646

4747
///////////////////////////////////////////////////////////////////////////////
4848
// Constructor
@@ -228,14 +228,14 @@ CBootDevice_PIC1::deviceInfo(void)
228228
//
229229

230230
int
231-
CBootDevice_PIC1::deviceInit(cguid& ourguid, uint16_t devicecode, bool bAbortOnFirmwareCodeFail)
231+
CBootDevice_PIC1::deviceInit(cguid &ourguid, uint16_t devicecode, bool bAbortOnFirmwareCodeFail)
232232
{
233233
int rv;
234234

235235
// Save our local GUID
236236
m_ourguid = ourguid;
237237

238-
// Save Firmware device code
238+
// Save Firmware device code
239239
m_firmwaredeviceCode = devicecode;
240240

241241
/*
@@ -359,7 +359,7 @@ CBootDevice_PIC1::deviceInit(cguid& ourguid, uint16_t devicecode, bool bAbortOnF
359359
// Set device in boot mode
360360
cguid guid;
361361
m_stdRegs.getGUID(guid);
362-
msg.data[0] = (uint8_t)m_nodeid; // Nickname to read register from
362+
msg.data[0] = (uint8_t) m_nodeid; // Nickname to read register from
363363
msg.data[1] = VSCP_BOOTLOADER_PIC1; // VSCP PIC1 bootloader algorithm
364364
msg.data[2] = guid.getAt(0);
365365
msg.data[3] = guid.getAt(3);
@@ -566,7 +566,7 @@ int
566566
CBootDevice_PIC1::writeDeviceControlRegs(uint32_t addr, uint8_t flags, uint8_t cmd, uint8_t cmdData0, uint8_t cmdData1)
567567
{
568568
int rv;
569-
//vscpEventEx event;
569+
// vscpEventEx event;
570570
canalMsg msg;
571571

572572
// Save the internal addresss
@@ -640,7 +640,7 @@ CBootDevice_PIC1::checkResponseLevel1(uint32_t response_id)
640640
// Response received from all - return success
641641
spdlog::debug("checkResponseLevel1: RECEIVE OK");
642642
if (nullptr != m_statusCallback) {
643-
//m_statusCallback(-1, "checkResponseLevel1: Response received OK.");
643+
// m_statusCallback(-1, "checkResponseLevel1: Response received OK.");
644644
}
645645
return VSCP_ERROR_SUCCESS;
646646
}
@@ -688,7 +688,7 @@ CBootDevice_PIC1::checkResponseLevel2(uint32_t id)
688688
// Response received - return success
689689
spdlog::debug("checkResponseLevel2: RECEIVE OK");
690690
if (nullptr != m_statusCallback) {
691-
//m_statusCallback(-1, "checkResponseLevel2: Response received OK.");
691+
// m_statusCallback(-1, "checkResponseLevel2: Response received OK.");
692692
}
693693
return VSCP_ERROR_SUCCESS;
694694
}
@@ -855,7 +855,7 @@ CBootDevice_PIC1::writeFirmwareBlock(uint32_t start, uint32_t end)
855855
}
856856

857857
// Start at beginning
858-
paddr += minAddr-start;
858+
paddr += minAddr - start;
859859

860860
for (uint32_t blk = 0; blk < nPackets; blk++) {
861861
spdlog::debug("Loading flash on remote device... block={0} {1:X}", blk, blk * 8);
@@ -865,11 +865,11 @@ CBootDevice_PIC1::writeFirmwareBlock(uint32_t start, uint32_t end)
865865
}
866866
paddr += 8;
867867
if (nullptr != m_statusCallback) {
868-
m_statusCallback((100 * blk) / nPackets, ""/*vscp_str_format("blk %d.", blk).c_str()*/);
868+
m_statusCallback((100 * blk) / nPackets, "" /*vscp_str_format("blk %d.", blk).c_str()*/);
869869
}
870870

871871
} // for
872-
} // code
872+
} // code
873873

874874
delete[] pbuf;
875875
return VSCP_ERROR_SUCCESS;
@@ -882,18 +882,18 @@ CBootDevice_PIC1::writeFirmwareBlock(uint32_t start, uint32_t end)
882882
int
883883
CBootDevice_PIC1::deviceLoad(std::function<void(int, const char *)> statusCallback, bool bAbortOnFirmwareCodeFail)
884884
{
885-
//bool bRun = true;
885+
// bool bRun = true;
886886
int rv;
887887

888-
m_checksum = 0;
889-
//uint32_t progress = 0;
888+
m_checksum = 0;
889+
// uint32_t progress = 0;
890890
uint32_t addr = 0;
891891
std::string strStatus;
892892

893-
//uint8_t pbuf[BUFFER_SIZE_CODE];
894-
//uint32_t nPackets;
895-
// uint32_t minAddr;
896-
// uint32_t maxAddr;
893+
// uint8_t pbuf[BUFFER_SIZE_CODE];
894+
// uint32_t nPackets;
895+
// uint32_t minAddr;
896+
// uint32_t maxAddr;
897897

898898
if (nullptr != m_statusCallback) {
899899
m_statusCallback(0, "Starting firmware download");

src/vscp/common/vscp-bootdevice-pic1.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
#pragma once
3535

36-
#include "vscp.h"
3736
#include "vscp-bootdevice.h"
37+
#include "vscp.h"
3838

3939
#include <string>
4040

@@ -127,8 +127,6 @@ class CBootDevice_PIC1 : public CBootDevice {
127127
MEM_TYPE_USERID // 0x200000
128128
};
129129

130-
131-
132130
// flags
133131
// CONTROL is defined as follows
134132
//
@@ -186,7 +184,7 @@ class CBootDevice_PIC1 : public CBootDevice {
186184
MDF is not the same as the one read from the remote device.
187185
@return VSCP_ERROR_SUCCESS on success.
188186
*/
189-
int deviceInit(cguid& ourguid, uint16_t devicecode, bool bAbortOnFirmwareCodeFail = false);
187+
int deviceInit(cguid &ourguid, uint16_t devicecode, bool bAbortOnFirmwareCodeFail = false);
190188

191189
/*!
192190
Write a boot block to the device
@@ -202,7 +200,8 @@ class CBootDevice_PIC1 : public CBootDevice {
202200
and status message (const char *)
203201
@return VSCP_ERROR_SUCCESS on success.
204202
*/
205-
int deviceLoad(std::function<void(int, const char *)> statusCallback = nullptr, bool bAbortOnFirmwareCodeFail = false);
203+
int deviceLoad(std::function<void(int, const char *)> statusCallback = nullptr,
204+
bool bAbortOnFirmwareCodeFail = false);
206205

207206
/*!
208207
Restart remote device

src/vscp/common/vscp-bootdevice.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
#include <spdlog/spdlog.h>
5656

5757
#include <fstream>
58+
#include <iomanip>
5859
#include <iostream>
59-
#include <iomanip>
60-
#include <sstream>
60+
#include <sstream>
6161

6262
///////////////////////////////////////////////////////////////////////////////
6363
// Ctor
@@ -104,9 +104,9 @@ CBootDevice::CBootDevice(CVscpClient *pclient,
104104
m_guid.clear();
105105
m_guid.setNicknameID(nodeid);
106106
m_guidif.clear();
107-
m_timeout = timeout;
108-
m_statusCallback = statusCallback;
109-
m_startAddr = 0; // Boot start
107+
m_timeout = timeout;
108+
m_statusCallback = statusCallback;
109+
m_startAddr = 0; // Boot start
110110
m_firmwaredeviceCode = 0;
111111
}
112112

@@ -162,8 +162,8 @@ int
162162
CBootDevice::loadIntelHexFile(const std::string &path)
163163
{
164164
char szline[2048];
165-
//char buf[16];
166-
//char *endptr;
165+
// char buf[16];
166+
// char *endptr;
167167
std::ifstream hexfile;
168168
uint16_t lowaddr = 0; // Low part of address
169169
uint16_t highaddr = 0; // High part if address

src/vscp/common/vscp-bootdevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ class CBootDevice {
274274
The device code tell the type of hardware of the remote device
275275
Must/should be the same as for the firmware we try to load.
276276
277+
This code is set in devicInit and is compared with the code in the device
278+
277279
Some (old) devices will have this code set to 0 in this cae no check
278280
should be performed.
279281
*/

src/vscp/common/vscp-class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
4848
This file is auto-generated
4949
see https://github.com/grodansparadis/vscp-classes
50-
Generated: 2024-11-05 21:03:46.717561
50+
Generated: 2024-12-09 21:43:36.673255
5151
*/
5252

5353
#ifndef VSCP_CLASS_H

src/vscp/common/vscp-hashclass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
33
This file is auto-generated
44
see https://github.com/grodansparadis/vscp-classes
5-
Generated: 2024-11-05 21:03:50.106254
5+
Generated: 2024-12-09 21:43:37.667848
66
*/
77

88
m_hashClass[ 0 ] = _("CLASS1_PROTOCOL");

src/vscp/common/vscp-hashtype.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
33
This file is auto-generated
44
see https://github.com/grodansparadis/vscp-classes
5-
Generated: 2024-11-05 21:03:51.292883
5+
Generated: 2024-12-09 21:43:38.327870
66
*/
77

88

@@ -51,8 +51,11 @@
5151
m_hashType[ MAKE_CLASSTYPE_LONG(0,41) ] = _("VSCP_TYPE_PROTOCOL_GET_EVENT_INTEREST_RESPONSE");
5252
m_hashType[ MAKE_CLASSTYPE_LONG(0,48) ] = _("VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_ACK");
5353
m_hashType[ MAKE_CLASSTYPE_LONG(0,49) ] = _("VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_NACK");
54-
m_hashType[ MAKE_CLASSTYPE_LONG(0,50) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_ACK");
54+
m_hashType[ MAKE_CLASSTYPE_LONG(0,50) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_ACK ");
5555
m_hashType[ MAKE_CLASSTYPE_LONG(0,51) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_NACK");
56+
m_hashType[ MAKE_CLASSTYPE_LONG(0,52) ] = _("VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_ACK ");
57+
m_hashType[ MAKE_CLASSTYPE_LONG(0,53) ] = _("VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_NACK");
58+
m_hashType[ MAKE_CLASSTYPE_LONG(0,54) ] = _("VSCP_TYPE_PROTOCOL_BOOT_LOADER_CHECK");
5659

5760
// CLASS1.ALARM = 1 - Alarm functionality
5861
m_hashType[ MAKE_CLASSTYPE_LONG(1,0) ] = _("VSCP_TYPE_ALARM_GENERAL");
@@ -1103,8 +1106,11 @@
11031106
m_hashType[ MAKE_CLASSTYPE_LONG(512,41) ] = _("VSCP_TYPE_PROTOCOL_GET_EVENT_INTEREST_RESPONSE");
11041107
m_hashType[ MAKE_CLASSTYPE_LONG(512,48) ] = _("VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_ACK");
11051108
m_hashType[ MAKE_CLASSTYPE_LONG(512,49) ] = _("VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_NACK");
1106-
m_hashType[ MAKE_CLASSTYPE_LONG(512,50) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_ACK");
1109+
m_hashType[ MAKE_CLASSTYPE_LONG(512,50) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_ACK ");
11071110
m_hashType[ MAKE_CLASSTYPE_LONG(512,51) ] = _("VSCP_TYPE_PROTOCOL_START_BLOCK_NACK");
1111+
m_hashType[ MAKE_CLASSTYPE_LONG(512,52) ] = _("VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_ACK ");
1112+
m_hashType[ MAKE_CLASSTYPE_LONG(512,53) ] = _("VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_NACK");
1113+
m_hashType[ MAKE_CLASSTYPE_LONG(512,54) ] = _("VSCP_TYPE_PROTOCOL_BOOT_LOADER_CHECK");
11081114

11091115
// CLASS2.LEVEL1.ALARM = 513 - Class2 Level I Alarm
11101116
// Event types is the same as CLASS1.ALARM = 1 - Alarm functionality

src/vscp/common/vscp-type.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
4949
This file is auto-generated
5050
see https://github.com/grodansparadis/vscp-classes
51-
Generated: 2024-11-05 21:03:48.911038
51+
Generated: 2024-12-09 21:43:37.152426
5252
*/
5353

5454
#ifndef VSCP_TYPE_H
@@ -101,8 +101,11 @@
101101
#define VSCP_TYPE_PROTOCOL_GET_EVENT_INTEREST_RESPONSE 41 /* Get event interest response. */
102102
#define VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_ACK 48 /* Activate new image ACK. */
103103
#define VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_NACK 49 /* Activate new image NACK. */
104-
#define VSCP_TYPE_PROTOCOL_START_BLOCK_ACK 50 /* Block data transfer ACK. */
105-
#define VSCP_TYPE_PROTOCOL_START_BLOCK_NACK 51 /* Block data transfer NACK. */
104+
#define VSCP_TYPE_PROTOCOL_START_BLOCK_ACK 50 /* Start Block ACK. */
105+
#define VSCP_TYPE_PROTOCOL_START_BLOCK_NACK 51 /* Start Block NACK. */
106+
#define VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_ACK 52 /* Block Data Chunk ACK. */
107+
#define VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_NACK 53 /* Block Data Chunk NACK. */
108+
#define VSCP_TYPE_PROTOCOL_BOOT_LOADER_CHECK 54 /* Bootloader CHECK. */
106109

107110
/* CLASS1.ALARM = 1 - Alarm functionality */
108111
#define VSCP_TYPE_ALARM_GENERAL 0 /* General event */

src/vscp/common/vscp.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,9 @@ struct vscpMyNode {
656656
#define VSCP_ERROR_SIZE 64 /* The size is wring */
657657
#define VSCP_ERROR_NACK 65 /* NACK received */
658658
#define VSCP_ERROR_READ_ERROR 66 /* Error when reading data */
659-
#define VSCP_ERROR_READ 66 /* Error when reading data */
659+
#define VSCP_ERROR_READ 66 /* DUPLICATE FOR CONVENIENCE! Error when reading data */
660+
#define VSCP_ERROR_INVALID_CHECKSUM 67 /* Checksum is not correct */
661+
#define VSCP_ERROR_INTERFACE 68 /* Interface error (not defined etc) */
660662

661663
/*!
662664
HLO (High Level Object) type (bits 7,6,5,4)

src/vscp/common/vscphelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/*!
2929
\file vscphelper.h
3030
\brief The vscphelper file contains often used functionality when
31-
working with VSCP. \details vscphealper have common used functionality to do
31+
working with VSCP. \details vscphelper have common used functionality to do
3232
things in the VSCP world. It can be seen as the main toolbox for the VSCP
3333
programmer.
3434
*/

0 commit comments

Comments
 (0)