Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ER_V/api_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main() {
LOG_INFO("Staring demo...");

// Setup buffers
uint16_t byte_len = sizeof(API_Data_Header) + sizeof(API_Data_Polar_Pan) + 2;
uint16_t byte_len = sizeof(API_Data_Header) + sizeof(API_Data_Polar_Pan) + 1;
uint8_t bytes[byte_len];
memset(&bytes[0], 0, byte_len);
char text[UTIL_BYTE_STR_FMT_LEN(byte_len)];
Expand All @@ -95,4 +95,4 @@ int main() {
LOG_INFO("Demo Ending...");
LOG_stop();
LOG_destroy();
}
}
2 changes: 1 addition & 1 deletion src/ER_V/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void dummy_msg(Subscriber* hermes) {

cmd->delay_ms = 0;

buf->len = sizeof(API_Data_Home) + sizeof(API_Data_Header) + 2;
buf->len = sizeof(API_Data_Home) + sizeof(API_Data_Header) + 1;
hermes->EnqueueBuffer(SUB_QUEUE_COMMAND, buf);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/Ichor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void dummy_msg(Subscriber* hermes) {

cmd->delay_ms = 0;

buf->len = sizeof(API_Data_Home) + sizeof(API_Data_Header) + 2;
buf->len = sizeof(API_Data_Home) + sizeof(API_Data_Header) + 1;
hermes->EnqueueBuffer(SUB_QUEUE_COMMAND, buf);
}
#endif
Expand Down
3 changes: 1 addition & 2 deletions src/common/api/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ int validate_command(const uint8_t* buf, uint16_t len) {

// Check CRC
// TODO: Implement
Comment thread
cwo3990 marked this conversation as resolved.
uint16_t* crc = (uint16_t*)(&cmd->payload_head + cmd->header.len);
*crc = be16toh(*crc);
uint8_t* crc = (uint8_t*)(&cmd->payload_head + cmd->header.len);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/socket/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ void Socket::poll() {

buf_iter += ret;

while (buf_iter >= sizeof(API::DataHeader) + 2) {
while (buf_iter >= sizeof(API::DataHeader) + 1) {
auto* msg = reinterpret_cast<API::DataWrapper*>(buffer.data());
uint16_t total_len =
sizeof(API::DataHeader) + be16toh(msg->header.len) + 2;
sizeof(API::DataHeader) + be16toh(msg->header.len) + 1;
if (buf_iter < total_len) break;

if (!props_.sub) {
Expand Down