Skip to content

Commit

Permalink
Remove unneeded include. Update version to 2.1.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobilinkd committed Feb 22, 2021
1 parent 46bfd7a commit dce5a25
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions TNC/KissHardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "KissHardware.h"
#endif

#include <memory>
#include <array>
#include <cstdio>
#include <cstring>
Expand Down Expand Up @@ -44,10 +43,10 @@ int powerOffViaUSB(void)
namespace mobilinkd { namespace tnc { namespace kiss {

#ifdef NUCLEOTNC
const char FIRMWARE_VERSION[] = "2.1.7";
const char FIRMWARE_VERSION[] = "2.1.8";
const char HARDWARE_VERSION[] = "Mobilinkd NucleoTNC";
#else
const char FIRMWARE_VERSION[] = "2.1.7";
const char FIRMWARE_VERSION[] = "2.1.8";
const char HARDWARE_VERSION[] = "Mobilinkd TNC3 2.1.1";
#endif

Expand Down Expand Up @@ -502,7 +501,7 @@ void Hardware::handle_request(hdlc::IoFrame* frame)

case hardware::SET_DATETIME:
DEBUG("SET_DATETIME");
set_rtc_datetime(&*it);
set_rtc_datetime(static_cast<const uint8_t*>(&*it));
[[fallthrough]];
case hardware::GET_DATETIME:
DEBUG("GET_DATETIME");
Expand Down Expand Up @@ -629,23 +628,22 @@ void Hardware::handle_ext_request(hdlc::IoFrame* frame) {
}
}

Hardware tmpHardware;

bool Hardware::load()
{
INFO("Loading settings from EEPROM");

auto tmp = std::make_unique<Hardware>();

if (!tmp) return false;
memset(tmp.get(), 0, sizeof(Hardware));
memset(&tmpHardware, 0, sizeof(Hardware));

if (!I2C_Storage::load(*tmp)) {
if (!I2C_Storage::load(tmpHardware)) {
ERROR("EEPROM read failed");
return false;
}

if (tmp->crc_ok())
if (tmpHardware.crc_ok())
{
memcpy(this, tmp.get(), sizeof(Hardware));
memcpy(this, &tmpHardware, sizeof(Hardware));
return true;
}
ERROR("EEPROM CRC error");
Expand Down

0 comments on commit dce5a25

Please sign in to comment.