Skip to content

Commit 255fd62

Browse files
authored
Mega avr support (#69)
* fix issue 68 * fix issue 63
1 parent 06b2539 commit 255fd62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/full/full.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ uint8_t readMemory(uint8_t fc, uint16_t address, uint16_t length)
132132
uint16_t value;
133133

134134
// Read a value from the EEPROM.
135-
EEPROM.get((address + i) * 2, value);
135+
EEPROM.get(address + (i * 2), value);
136136

137137
// Write the value from EEPROM to the response buffer.
138138
slave.writeRegisterToBuffer(i, value);
@@ -215,7 +215,7 @@ uint8_t writeMemory(uint8_t fc, uint16_t address, uint16_t length)
215215
uint16_t value = slave.readRegisterFromBuffer(i);
216216

217217
// Store the received value in the EEPROM.
218-
EEPROM.put(address + i * 2, value);
218+
EEPROM.put(address + (i * 2), value);
219219
}
220220
}
221221

src/ModbusSlave.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class Modbus
136136

137137
Stream &_serialStream;
138138

139-
#ifndef ARDUINO_ARCH_AVR
139+
#if defined ARDUINO_ARCH_AVR || defined AVR_NANO_EVERY || defined AVR_UNO_WIFI_REV2
140140
int _serialTransmissionBufferLength = SERIAL_BUFFER_SIZE;
141141
#else
142142
int _serialTransmissionBufferLength = SERIAL_TX_BUFFER_SIZE;

0 commit comments

Comments
 (0)