Added other method of read for vsd

This commit is contained in:
2024-12-04 19:57:35 +02:00
parent bf95ffed05
commit dc2b3429a6
5 changed files with 519 additions and 3 deletions

View File

@@ -16,7 +16,7 @@
#define MODBUS_SERIAL_BAUDRATE 19200
#define LED_A_PID 3
#define LED_B_PID 5
#define MAX_RETRIES 3
#define MAX_RETRIES 1
#define ERROR_VALUE -999.99
#define SPI_CLOCK SD_SCK_MHZ(50)
@@ -125,7 +125,7 @@ void getFilename(char* buffer) {
float readRegisterWithRetry(uint16_t addr, uint8_t regtype) {
for(uint8_t retry = 0; retry < MAX_RETRIES; retry++) {
delay(10);
delay(5);
uint8_t result = node.readHoldingRegisters(addr - 1, 2);
if(result == node.ku8MBSuccess) {
switch(regtype) {
@@ -147,7 +147,7 @@ float readRegisterWithRetry(uint16_t addr, uint8_t regtype) {
Serial.print(F(", error code: "));
Serial.println(result);
delay(50 * (retry + 1));
delay(5 * (retry + 1));
flicker(LED_B_PID, 1, 50);
}
return ERROR_VALUE;