Skip to content

Commit

Permalink
custom telemetry changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed May 8, 2024
1 parent b0a6a08 commit e1a5a7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions telemetry-collector/ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const commonConfig = {
"INTERNAL_UDP_HOST": "localhost",
"INTERNAL_UDP_PORT": "8000",
"EXTERNAL_UDP_PORT": "8000",
"UART_BAUD_RATE": "57600",
"UART_BAUD_RATE": "3000000",
}

module.exports = {
Expand All @@ -12,7 +12,7 @@ module.exports = {
script: "./collector",
env: {
"EXTERNAL_UDP_HOST": "api.ufsolargators.org",
"UART_PORT": "/tmp/uart",
"UART_PORT": "/dev/ttyACM0",
...commonConfig,
},
env_ci: {
Expand Down
8 changes: 4 additions & 4 deletions telemetry-collector/src/lib/NetworkReceive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

void NetworkReceive::fromByteArray(u_int8_t *buff) {
this->can_id = (int)buff[3] | ((int)buff[2] << 8) | ((int)buff[1] << 16) | ((int)buff[0] << 24);
this->instance_id = buff[4];
this->size = buff[5];
this->crc = (int)buff[7] | ((int)buff[6] << 8);
this->data = &buff[8];
//this->instance_id = buff[4];
this->size = buff[4];
//this->crc = (int)buff[7] | ((int)buff[6] << 8);
this->data = &buff[5];
}
6 changes: 4 additions & 2 deletions telemetry-collector/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,20 @@ int main(int argc, char *argv[]) {
continue;
}
network.fromByteArray(dataLink.buffer);
/*
uint16_t crc = SolarGators::Helpers::crc16(network.data, network.size);
if (crc != network.crc) {
Logger::info("Error: CRC did not match, skipping.\n");
continue;
}

*/
//Get module
if (modules.count(network.can_id) > 0) {
SolarGators::DataModules::DataModule* rx_module = (*modules.find(network.can_id)).second;
rx_module->FromByteArray(network.data);
rx_module->PostTelemetry(&scripts);
}
Logger::info("success/n");
}
dataLink.flush();
}

Expand Down

0 comments on commit e1a5a7f

Please sign in to comment.