Resolve some MSVC warnings
parent
d86f15ab4c
commit
7e7a969f28
|
|
@ -54,11 +54,11 @@ std::vector<uint8_t> Encoder::encode(const std::shared_ptr<Message>& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(shortFormat) {
|
if(shortFormat) {
|
||||||
message->data.insert(message->data.begin(), (message->data.size() << 4) | (uint8_t)message->network.getNetID());
|
message->data.insert(message->data.begin(), (uint8_t(message->data.size()) << 4) | uint8_t(message->network.getNetID()));
|
||||||
} else {
|
} else {
|
||||||
// Size in long format is the size of the entire packet
|
// Size in long format is the size of the entire packet
|
||||||
// So +1 for AA header, +1 for short format header, +2 for long format size, and +2 for long format NetID
|
// So +1 for AA header, +1 for short format header, +2 for long format size, and +2 for long format NetID
|
||||||
uint16_t size = message->data.size() + 1 + 1 + 2 + 2;
|
uint16_t size = uint16_t(message->data.size()) + 1 + 1 + 2 + 2;
|
||||||
message->data.insert(message->data.begin(), {
|
message->data.insert(message->data.begin(), {
|
||||||
(uint8_t)Network::NetID::RED, // 0x0C for long message
|
(uint8_t)Network::NetID::RED, // 0x0C for long message
|
||||||
(uint8_t)size, // Size, little endian 16-bit
|
(uint8_t)size, // Size, little endian 16-bit
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ bool IDeviceSettings::commit() {
|
||||||
com->sendCommand(Command::SaveSettings);
|
com->sendCommand(Command::SaveSettings);
|
||||||
std::shared_ptr<Message> msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000));
|
std::shared_ptr<Message> msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000));
|
||||||
|
|
||||||
refresh(); // Refresh our buffer with what the device has, whether we were successful or not
|
refresh(); // Refresh our buffer with what the device has, whether we were successful or not
|
||||||
|
|
||||||
return (msg && msg->data[0] == 1); // Device sends 0x01 for success
|
return (msg && msg->data[0] == 1); // Device sends 0x01 for success
|
||||||
}
|
}
|
||||||
|
|
@ -134,16 +134,16 @@ bool IDeviceSettings::commit() {
|
||||||
bool IDeviceSettings::setBaudrateFor(Network net, uint32_t baudrate) {
|
bool IDeviceSettings::setBaudrateFor(Network net, uint32_t baudrate) {
|
||||||
switch(net.getType()) {
|
switch(net.getType()) {
|
||||||
case Network::Type::CAN: {
|
case Network::Type::CAN: {
|
||||||
CAN_SETTINGS* settings = getCANSettingsFor(net);
|
CAN_SETTINGS* cfg = getCANSettingsFor(net);
|
||||||
if(settings == nullptr)
|
if(cfg == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint8_t newBaud = getEnumValueForBaudrate(baudrate);
|
uint8_t newBaud = getEnumValueForBaudrate(baudrate);
|
||||||
if(newBaud == 0xFF)
|
if(newBaud == 0xFF)
|
||||||
return false;
|
return false;
|
||||||
settings->Baudrate = newBaud;
|
cfg->Baudrate = newBaud;
|
||||||
settings->auto_baud = false;
|
cfg->auto_baud = false;
|
||||||
settings->SetBaudrate = AUTO; // Use the baudrate values instead of the TQ values
|
cfg->SetBaudrate = AUTO; // Device will use the baudrate value to set the TQ values
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -290,8 +290,8 @@ public:
|
||||||
|
|
||||||
virtual bool setBaudrateFor(Network net, uint32_t baudrate);
|
virtual bool setBaudrateFor(Network net, uint32_t baudrate);
|
||||||
|
|
||||||
virtual CAN_SETTINGS* getCANSettingsFor(Network net) { return nullptr; }
|
virtual CAN_SETTINGS* getCANSettingsFor(Network net) { (void)net; return nullptr; }
|
||||||
virtual CANFD_SETTINGS* getCANFDSettingsFor(Network net) { return nullptr; }
|
virtual CANFD_SETTINGS* getCANFDSettingsFor(Network net) { (void)net; return nullptr; }
|
||||||
|
|
||||||
void* getRawStructurePointer() { return settings.data(); }
|
void* getRawStructurePointer() { return settings.data(); }
|
||||||
template<typename T> T* getStructurePointer() { return static_cast<T*>((void*)settings.data()); }
|
template<typename T> T* getStructurePointer() { return static_cast<T*>((void*)settings.data()); }
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
std::vector<std::shared_ptr<Device>> found;
|
std::vector<std::shared_ptr<Device>> found;
|
||||||
|
|
||||||
for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) {
|
for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) {
|
||||||
{
|
{ // Scope created so that we don't have two of the same device at once
|
||||||
strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial));
|
strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial));
|
||||||
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
||||||
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
|
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CANFD_SETTINGS* getCANFDSettingsFor(Network net) override { return nullptr; }
|
// CANFD_SETTINGS* getCANFDSettingsFor(Network net) override { return nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue