Skip to content

Commit

Permalink
Fixed some build problems on the Windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Sep 25, 2024
1 parent 6a8ade5 commit 3963dbc
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 101 deletions.
98 changes: 51 additions & 47 deletions src/vscp/common/vscp-bootdevice-pic1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
// #include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>

#include <iostream>
#include <iomanip>
#include <sstream>

///////////////////////////////////////////////////////////////////////////////
// Constructor
//
Expand Down Expand Up @@ -128,93 +132,93 @@ CBootDevice_PIC1::deviceInfo(void)
uint32_t max;

// * * * Device * * *
oss << std::string("<b><u>Device</u></b><br>");
oss << std::string("<b>nodeid :</b><font color=\"#005CB9\">");
oss << "<b><u>Device</u></b><br>";
oss << "<b>nodeid :</b><font color=\"#005CB9\">";
oss << m_nodeid;
oss << std::string("</font><br>");
oss << std::string("<b>GUID :</b><font color=\"#005CB9\">");
oss << "</font><br>";
oss << "<b>GUID :</b><font color=\"#005CB9\">";
oss << m_guid.toString();
oss << std::string("</font><br>");
oss << std::string("<b>Interface :</b><font color=\"#005CB9\">");
oss << "</font><br>";
oss << "<b>Interface :</b><font color=\"#005CB9\">";
oss << m_guidif.toString();
oss << std::string("</font><br>");
oss << "</font><br>";

// * * * Flash Memory * * *
getMinMaxForRange(MEM_CODE_START, MEM_CODE_END, &min, &max);
oss << std::string("<b><u>Flash Memory</u></b><br>");
oss << std::string("<b>Start :</b><font color=\"#005CB9\">");
oss << "<b><u>Flash Memory</u></b><br>";
oss << "<b>Start :</b><font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min;
oss << std::string("</font><b> End :</b><font color=\"#005CB9\">");
oss << "</font><b> End :</b><font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max;
if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * UserID Memory * * *
getMinMaxForRange(MEM_USERID_START, MEM_CODE_END, &min, &max);
oss << std::string("<b><u>UserID Memory</u></b><br>");
oss << std::string("<b>Start :</b>");
oss << "<b><u>UserID Memory</u></b><br>";
oss << "<b>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";

oss << std::string("<b> End :</b>");
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << max << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * Config Memory * * *
getMinMaxForRange(MEM_CONFIG_START, MEM_CONFIG_END, &min, &max);
oss << std::string("<b><u>Config Memory</u></b><br>");
oss << std::string("<b>Start :</b>");
oss << "<b><u>Config Memory</u></b><br>";
oss << "<b>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";

oss << std::string("<b> End :</b>");
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << max << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * EEPROM * * *
getMinMaxForRange(MEM_EEPROM_START, MEM_EEPROM_END, &min, &max);
oss << std::string("<b><u>EEPROM Memory</u></b><br>");
oss << std::string("<B>Start :</b>");
oss << "<b><u>EEPROM Memory</u></b><br>";
oss << "<B>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << std::string("<b> End :</b>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << PRIdMAX << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << PRIdMAX << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

return oss.str();
}
Expand Down Expand Up @@ -352,7 +356,7 @@ CBootDevice_PIC1::deviceInit(cguid& ourguid, uint8_t devicecode, bool bAbortOnFi
// Set device in boot mode
cguid guid;
m_stdRegs.getGUID(guid);
msg.data[0] = m_nodeid; // Nickname to read register from
msg.data[0] = (uint8_t)m_nodeid; // Nickname to read register from
msg.data[1] = VSCP_BOOTLOADER_PIC1; // VSCP PIC1 bootloader algorithm
msg.data[2] = guid.getAt(0);
msg.data[3] = guid.getAt(3);
Expand Down Expand Up @@ -559,7 +563,7 @@ int
CBootDevice_PIC1::writeDeviceControlRegs(uint32_t addr, uint8_t flags, uint8_t cmd, uint8_t cmdData0, uint8_t cmdData1)
{
int rv;
vscpEventEx event;
//vscpEventEx event;
canalMsg msg;

// Save the internal addresss
Expand Down Expand Up @@ -883,8 +887,8 @@ CBootDevice_PIC1::deviceLoad(std::function<void(int, const char *)> statusCallba
uint32_t addr = 0;
std::string strStatus;

uint8_t pbuf[BUFFER_SIZE_CODE];
uint32_t nPackets;
//uint8_t pbuf[BUFFER_SIZE_CODE];
//uint32_t nPackets;
// uint32_t minAddr;
// uint32_t maxAddr;

Expand Down
98 changes: 51 additions & 47 deletions src/vscp/common/vscp-bootdevice-vscp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>

#include <iostream>
#include <iomanip>
#include <sstream>

CBootDevice_VSCP::CBootDevice_VSCP(CVscpClient *pclient,
uint8_t nodeid,
std::function<void(int, const char *)> statusCallback,
Expand Down Expand Up @@ -111,93 +115,93 @@ CBootDevice_VSCP::deviceInfo(void)
uint32_t max;

// * * * Device * * *
oss << std::string("<b><u>Device</u></b><br>");
oss << std::string("<b>nodeid :</b><font color=\"#005CB9\">");
oss << "<b><u>Device</u></b><br>";
oss << "<b>nodeid :</b><font color=\"#005CB9\">";
oss << m_nodeid;
oss << std::string("</font><br>");
oss << std::string("<b>GUID :</b><font color=\"#005CB9\">");
oss << "</font><br>";
oss << "<b>GUID :</b><font color=\"#005CB9\">";
oss << m_guid.toString();
oss << std::string("</font><br>");
oss << std::string("<b>Interface :</b><font color=\"#005CB9\">");
oss << "</font><br>";
oss << "<b>Interface :</b><font color=\"#005CB9\">";
oss << m_guidif.toString();
oss << std::string("</font><br>");
oss << "</font><br>";

// * * * Flash Memory * * *
getMinMaxForRange(MEM_CODE_START, MEM_CODE_END, &min, &max);
oss << std::string("<b><u>Flash Memory</u></b><br>");
oss << std::string("<b>Start :</b><font color=\"#005CB9\">");
oss << "<b><u>Flash Memory</u></b><br>";
oss << "<b>Start :</b><font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min;
oss << std::string("</font><b> End :</b><font color=\"#005CB9\">");
oss << "</font><b> End :</b><font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max;
if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * UserID Memory * * *
getMinMaxForRange(MEM_USERID_START, MEM_CODE_END, &min, &max);
oss << std::string("<b><u>UserID Memory</u></b><br>");
oss << std::string("<b>Start :</b>");
oss << "<b><u>UserID Memory</u></b><br>";
oss << "<b>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";

oss << std::string("<b> End :</b>");
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * Config Memory * * *
getMinMaxForRange(MEM_CONFIG_START, MEM_CONFIG_END, &min, &max);
oss << std::string("<b><u>Config Memory</u></b><br>");
oss << std::string("<b>Start :</b>");
oss << "<b><u>Config Memory</u></b><br>";
oss << "<b>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";

oss << std::string("<b> End :</b>");
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << max << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << max << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

// * * * EEPROM * * *
getMinMaxForRange(MEM_EEPROM_START, MEM_EEPROM_END, &min, &max);
oss << std::string("<b><u>EEPROM Memory</u></b><br>");
oss << std::string("<B>Start :</b>");
oss << "<b><u>EEPROM Memory</u></b><br>";
oss << "<B>Start :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << min << std::string("</font>");
oss << std::string("<b> End :</b>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << min << "</font>";
oss << "<b> End :</b>";

oss << std::string("<font color=\"#005CB9\">");
oss << std::hex << std::setw(8) << std::setfill('0') << PRIdMAX << std::string("</font>");
oss << "<font color=\"#005CB9\">";
oss << std::hex << std::setw(8) << std::setfill('0') << PRIdMAX << "</font>";

if (max > min) {
oss << std::string("<font color=\"#348017\">Will be programmed</font><br>");
oss << "<font color=\"#348017\">Will be programmed</font><br>";
}
else {
oss << std::string("<font color=\"#F6358A\">Will not be programmed</font><br>");
oss << "<font color=\"#F6358A\">Will not be programmed</font><br>";
}
oss << std::string("<br><br>");
oss << "<br><br>";

return oss.str();
}
Expand Down Expand Up @@ -256,7 +260,7 @@ CBootDevice_VSCP::deviceInit(cguid &ourguid, uint8_t devicecode, bool bAbortOnFi
m_stdRegs.getGUID(node_guid);

ex.sizeData = 8;
ex.data[0] = m_nodeid; // Nickname to read register from
ex.data[0] = (uint8_t)m_nodeid; // Nickname to read register from
ex.data[1] = VSCP_BOOTLOADER_VSCP; // VSCP bootloader algorithm
ex.data[2] = node_guid.getAt(0);
ex.data[3] = node_guid.getAt(3);
Expand Down Expand Up @@ -456,7 +460,7 @@ int
CBootDevice_VSCP::writeBlock(const uint8_t *paddr)
{
int rv;
vscpEventEx ex;
//vscpEventEx ex;
cguid guid;
uint32_t nChunks;

Expand Down Expand Up @@ -504,10 +508,10 @@ int
CBootDevice_VSCP::deviceLoad(std::function<void(int, const char *)> statusCallback, bool bAbortOnFirmwareCodeFail)
{
int rv;
vscpEventEx ex;
//vscpEventEx ex;

uint32_t progress = 0;
uint32_t addr;
//uint32_t addr;
std::string strStatus;

m_checksum = 0;
Expand Down Expand Up @@ -638,7 +642,7 @@ CBootDevice_VSCP::deviceLoad(std::function<void(int, const char *)> statusCallba
int
CBootDevice_VSCP::deviceReboot(void)
{
int rv;
//int rv;

return VSCP_ERROR_SUCCESS;
}
Expand Down
Loading

0 comments on commit 3963dbc

Please sign in to comment.