Skip to content

Commit

Permalink
Significant IO Control library updates (#2680)
Browse files Browse the repository at this point in the history
## Fixes

Fix request ID defaulting to "null" string

bugfix: Device state handling
- Device::stop() doesn't update state
- Clear fault state on successful request

Fix `toString(Request)` not available compiler error

Fix issue with TX DONE interrupt on RP2040
- Fires when FIFO drops below 25% so needs more padding.

Fix Modbus GenericRequest 'bad_node' error

Bugfix: Cannot flush uart from ISR (RS485)

Fix possible double-call during modbus execute event

Bugfix: activeConfig not set in Serial

Fix uninitialised default values

Fix RFSwitch output initialisation and idling

## Improvements

Use nested namespaces (C++17)

`Device::nodeIdMax()` is calculated, doesn't need to be virtual

Tidy up Device factory inheritance

Add devmgr `findDevice` method template to handle up-casting

Add device parameter to support minimum interval between transactions

Put `toString` function overloads in global namespace

Omit `command` from JSON responses if undefined

Improve DMX512
- Fix segment not being set
- Add device `fade` option
- Implement `query` command
- Tidy up `Request::nodeSet()` and `nodeAdjust()`, virtualise `setValue()`

Improve RS485
- Add gpio numbers to `Serial::open()`

Revise modbus PDU structure
- Structure for input/holding registers is identical
- Add methods for accessing coil bits

RS485 devices can override default transaction timeout

Add modbus `GenericRequest` support, plus transfer callback hook

Allow RS485 per-request Slave Address override (e.g. for broadcast requests)

Reduce RS485 debug verbosity

Complete RS485 receive using timer to avoid premature request completion. This enables support for general RS232 communication where responses may be a bit bursty.

Add Custom class. May serve as a useful starting point for new devices.

## New devices

Add RI-D35 modbus energy meter

Add STM8Relay modbus relay board support.
- New 4-channel modbus board uses coil commands (0-based) and has 4 digital inputs
- Use `update` command to change stm8relay slave address

Add NT18B07 NTC temperature sensor board

Add STS fan controller sample project
    This is a real application used to control three PWM fans for cooling a hybrid solar inverter.
    Uses RPi Pico as hardware can generate PWM and measure speed.
  • Loading branch information
mikee47 authored Oct 21, 2023
1 parent ba3626c commit 92b9737
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sming/Libraries/IOControl
Submodule IOControl updated 92 files
+10 −0 docs/nt18b07/index.rst
+ docs/nt18b07/nt18b07.jpg
+10 −0 docs/r421a/index.rst
+ docs/rid35/OP_RI-D35-100-C_OP663-V01.pdf
+ docs/rid35/RI_Data_Sheet_RI-D35_Series_MID_W_21_11_18_18.pdf
+9 −0 docs/rid35/index.rst
+ docs/rid35/ri-d35.jpg
+57 −0 docs/stm8relay/index.rst
+ docs/stm8relay/stm8relay.jpg
+8 −3 include/IO/Controller.h
+51 −0 include/IO/Custom/Controller.h
+71 −0 include/IO/Custom/Device.h
+74 −0 include/IO/Custom/Request.h
+27 −26 include/IO/DMX512/Device.h
+5 −14 include/IO/DMX512/Request.h
+1 −1 include/IO/DevNode.h
+12 −3 include/IO/Device.h
+14 −0 include/IO/DeviceManager.h
+2 −0 include/IO/DeviceType.h
+1 −0 include/IO/Error.h
+2 −2 include/IO/Event.h
+2 −5 include/IO/Modbus/ADU.h
+2 −5 include/IO/Modbus/Debug.h
+23 −5 include/IO/Modbus/Device.h
+3 −24 include/IO/Modbus/Exception.h
+3 −6 include/IO/Modbus/Function.h
+44 −0 include/IO/Modbus/GenericRequest.h
+107 −0 include/IO/Modbus/NT18B07/Device.h
+45 −0 include/IO/Modbus/NT18B07/Request.h
+25 −35 include/IO/Modbus/PDU.h
+5 −27 include/IO/Modbus/R421A/Device.h
+4 −10 include/IO/Modbus/R421A/Request.h
+128 −0 include/IO/Modbus/RID35/Device.h
+51 −0 include/IO/Modbus/RID35/Request.h
+20 −10 include/IO/Modbus/Request.h
+112 −0 include/IO/Modbus/STM8Relay/Device.h
+102 −0 include/IO/Modbus/STM8Relay/Request.h
+74 −0 include/IO/Modbus/STS/Fan/Device.h
+63 −0 include/IO/Modbus/STS/Fan/Request.h
+2 −5 include/IO/Modbus/Slave.h
+5 −5 include/IO/RFSwitch/Controller.h
+3 −6 include/IO/RFSwitch/Device.h
+3 −6 include/IO/RFSwitch/Request.h
+16 −11 include/IO/RS485/Controller.h
+28 −6 include/IO/RS485/Device.h
+40 −0 include/IO/RS485/Request.h
+27 −6 include/IO/Request.h
+11 −1 include/IO/Serial.h
+4 −1 include/IO/Strings.h
+1 −0 samples/FanControl/.gitignore
+ samples/FanControl/4_Wire_PWM_Spec.pdf
+9 −0 samples/FanControl/Makefile
+8 −0 samples/FanControl/README.rst
+72 −0 samples/FanControl/app/Fan.cpp
+60 −0 samples/FanControl/app/Fan.h
+217 −0 samples/FanControl/app/application.cpp
+10 −0 samples/FanControl/component.mk
+13 −0 samples/FanControl/fancon.hw
+26 −36 src/Controller.cpp
+31 −0 src/Custom/Controller.cpp
+48 −0 src/Custom/Device.cpp
+58 −0 src/Custom/Request.cpp
+22 −10 src/DMX512/Device.cpp
+17 −6 src/DMX512/Request.cpp
+22 −0 src/Device.cpp
+1 −1 src/DeviceManager.cpp
+4 −4 src/Event.cpp
+2 −5 src/Modbus/ADU.cpp
+2 −5 src/Modbus/Debug.cpp
+26 −12 src/Modbus/Device.cpp
+40 −0 src/Modbus/Exception.cpp
+41 −0 src/Modbus/Function.cpp
+214 −0 src/Modbus/GenericRequest.cpp
+100 −0 src/Modbus/NT18B07/Device.cpp
+64 −0 src/Modbus/NT18B07/Request.cpp
+2 −38 src/Modbus/PDU.cpp
+3 −9 src/Modbus/R421A/Device.cpp
+2 −8 src/Modbus/R421A/Request.cpp
+137 −0 src/Modbus/RID35/Device.cpp
+94 −0 src/Modbus/RID35/Request.cpp
+100 −0 src/Modbus/STM8Relay/Device.cpp
+234 −0 src/Modbus/STM8Relay/Request.cpp
+43 −0 src/Modbus/STS/Fan/Device.cpp
+108 −0 src/Modbus/STS/Fan/Request.cpp
+2 −5 src/Modbus/Slave.cpp
+10 −9 src/RFSwitch/Controller.cpp
+2 −5 src/RFSwitch/Device.cpp
+2 −5 src/RFSwitch/Request.cpp
+55 −50 src/RS485/Controller.cpp
+3 −5 src/RS485/Device.cpp
+11 −5 src/Request.cpp
+7 −3 src/Serial.cpp

0 comments on commit 92b9737

Please sign in to comment.