Skip to content

Commit

Permalink
firmata#136 : sizeOf Int depends on the board, use of int16_t OneWire…
Browse files Browse the repository at this point in the history
…Firmata::handleSysex

Several users reports memory pb with the OneWire handleSysex method. 
I've tested this change on arduino Zero. No more freeze.
  • Loading branch information
echavet authored Apr 23, 2023
1 parent 29481c4 commit 978c4cf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/OneWireFirmata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ boolean OneWireFirmata::handleSysex(byte command, byte argc, byte* argv)

if (subcommand & ONEWIRE_READ_REQUEST_BIT) {
if (numBytes < 4) break;
numReadBytes = *((int*)argv);
argv += 2;
correlationId = *((int*)argv);
argv += 2;
numBytes -= 4;
numReadBytes = *((int16_t*)argv);
argv += sizeof(int16_t);
correlationId = *((int16_t*)argv);
argv += sizeof(int16_t);
numBytes -= 2 * sizeof(int16_t);
}

if (subcommand & ONEWIRE_DELAY_REQUEST_BIT) {
Expand Down

0 comments on commit 978c4cf

Please sign in to comment.