I2Cwrapper v0.5.0
Generic framework for Arduino I2C target devices
|
add emergency stop/break pin for target (just use reset pin for the moment)
ATM data is not protected against updates from ISRs while it is being used in the main program (see http://gammon.com.au/interrupts). Check if this could be a problem in our case.
ESP32: make use of dual cores?
use interrupts for endstops instead of main loop polling (not sure how much of a difference this would make in practice, though. The main loop isn't doing much else, what really takes time are the computations.)
update keywords.txt
clean up example sketches
implement runToPosition() and runToNewPosition() in controller - implemented
test (and adapt) target firmware for ESP8266 - implemented. However, I2C target mode on ESP8266s is no fun. Run only with 160MHz CPU and start testing with 10kHz (that's right: ten kHz) I2C clock speed.
checking each transmission with sentOK and resultOK is tedious. We could use some counter to accumulate errors and check them summarily, e.g. at the end of setup etc. - AccelStepperI2C::sentErrors(), AccelStepperI2C::resultErrors() and AccelStepperI2C::transmissionErrors() added
make time the target has to answer I2C requests (I2CrequestDelay) configurable, as it will depend on µC and bus frequency etc. - setI2Cdelay() implemented
Versioning, I2C command to request version (important, as library and firmware always need to match) - getVersion() and checkVersion() implemented
Implement interrupt mechanism, so that the target can inform the controller about finished tasks or other events - setInterruptPin() and enableInterrupts() implemented
implement diagnostic functions, e.g. measurements how long messages take to be processed or current stepper pulse frequency - done, performance graphs included in documentation
add ESP32 compatibility for target - done, but needs further testing
Make the I2C address programmable and persistent in EEPROM. - done
Error handling and sanity checks are rudimentary. Currently the system is not stable against transmission errors, partly due to the limitations of Wire.requestFrom() and Wire.available(). A better protocol would be needed, which would mean more overhead. Need testing to see how important this is in practics. - CRC8 implemented
Implement end stops/reference stops. - endstop polling implemented, interrupt would be better
make I2C address configurable by hardware (with module?)
return messages (results) should ideally come with an id, too, so that controller can be sure it's the correct result. Currently only CRC8, i.e. correct transmission is checked.
volatile variables / ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {}
Reduce memory use to make it fit into an 8k Attiny4k ATtiny