-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Things that should already be fixed in ConfigurableFirmata #136
Comments
Thanks for reporting. Can you please open a pull request with your suggested changes? I have not found an use case for the FirmataScheduler, can you provide information about how you use it and with which client library? |
a better modification for compatibility should be to replace in
by
|
@echavet Ok, that makes sense. I have never used the onewire module myself, so I cannot test this. Could you create a PR, please? |
On esp32,
It shoud be get data is |
…Firmata::handleSysex Several users reports memory pb with the OneWire handleSysex method. I've tested this change on arduino Zero. No more freeze.
@awong1900 That method works just fine, but maybe differently than what you would expect. This is not the reverse of The correct result for your example is |
#136 : sizeOf Int depends on the board, use of int16_t OneWireFirmata…
The START_SYEX and END_SYSEX bytes do not count
I didn't see the " with this: Firmata.delayTask(argv[0] | ((long)argv[1] << 8) | ((long)argv[2] << 16) | ((long)argv[3] << 24)); This is a bit surprising, given that all the platforms (esp8266, ardiono uno or zero for me) in question are little endian and the "long" data type is consistently 32 bits in size. Despite this, users have reported that the proposed code change resolves the issue! For me, this problem arises when working with Arduino Uno, but not with Arduino Zero. Interestingly, the occurrence of the error seems to be contingent upon the inclusion of FirmataScheduler, as defined by the configuration typedef constant: #ifdef ENABLE_BASIC_SCHEDULER Looking for an explanation, I discovered that the implementation of the delayTaskCallback function is specific to FirmataScheduler. It calls void FirmataScheduler::delayTask(long delay_ms)
{
if (running) {
long now = millis();
running->time_ms += delay_ms;
if (running->time_ms < now) { // If delay time already passed, schedule to 'now'.
running->time_ms = now;
}
}
} I am no longer able to test this, but I believe that without if (delayTaskCallback) {
(*delayTaskCallback)(delay);
} Now let's consider the comparison between these two scenarios:
Given that I'm using the Johnny-Five library, and its implementation of the DS18B20 thermometer uses My hypothesis is that there would be no discernible difference with a longer delay period when /**
* Call the delayTask callback function when using FirmataScheduler. Must first attach a callback
* using attachDelayTask.
* @see FirmataScheduler
* @param delay The amount of time to delay in milliseconds.
*/
void FirmataClass::delayTask(long delayMs) {
if (delayTaskCallback) {
(*delayTaskCallback)(delayMs);
}
// adding a default implementation seems to solve the issue
else {
delay(delayMs);
}
} What do you think of that ? |
@echavet Sorry, I've lost track of this issue. But are you saying that the fix in your last post is the only thing required to fix the FirmataScheduler problem? Also, what client library are you using to test this? |
I'm using johnny-five client library. What I'm saying is that there might be some misconceptions in the one-wire configurableFirmata, links to these delays. I.m not sure it solved all the problems but I've managed to get it work with 3 or 4 thermometers connected to an Uno board which is connected via usb to a RPI 4. This works with homeassistant in an add-on I'm working on ( https://github.com/echavet/j5_ha_bridge). |
I don't have any one-wire devices, so I cannot test that implementation. When you got it to work, did you need any changes to ConfigurableFirmata? |
Bugs reported long ago and not fixed yet:
Fix the compatibility problem of FirmataScheduler and OnewireFirmata with devices other than Arduino Uno, like ESP8266, ESP32 and probably others due to different sizes of pointer, Int and long.
New bug detected:
A bug (hard to detect) when the size of the SYSEX command to send is 64 (buffer size), the last byte is lost, works fine with any other value, solution at the end.
Modify file FirmataScheduler.cpp in this way
inside this function
boolean FirmataScheduler::handleSysex(byte command, byte argc, byte* argv)
void FirmataScheduler::reportTask(byte id, firmata_task* task, boolean error)
Modify file OnwwireFirmata.cpp in this way
inside this function
boolean OneWireFirmata::handleSysex(byte command, byte argc, byte* argv)
Change ConfigurableFirmata.cpp (lost last byte when command size is 64)
Change inside this function
void FirmataClass::parse(byte inputData)
For this
The text was updated successfully, but these errors were encountered: