Skip to content

Commit

Permalink
RS485 Hotline Protocol Receiver/Transmitter (#5)
Browse files Browse the repository at this point in the history
* Hotline Protocol: DDigital I/O control over RS485
- Protocol: Docs and Implementation
- fire/: rs485 receiver using hotline for control of effect heads, pilots, etc.
- controller/: 13 input (with 1 broadcast) rs485 transmitter using Hotline
- added to ci

* fmt

* fix: controller input limit and last control ID

* refactor: naming

* fixes: from refactor & lint

* fmt

* remove debug

* feat: handle received messages for dio

* fix: track state changes

* fix: high state 0x01 not 0xFF

* docs: Input to Output Trace

* docs: fix readme for input controller

* megapoofer device id 0x01

* duplicate outputcontroller -> megapoofer & sign

* remove output_controller

* docs: fix pilot pin

* reduce inputs and handle device ID

* remove unused import

* MegaPoofer Device ID 0x01

* fix: ci and lint

* allow only MP or Sign to be run, or both

* refactor: Input Resilience & Combined Output Controllers
- Update Hotline Protocol to send 16 states in 2 bytes
- Combine Sign and MP output controllers with optional eval of dio states based on installation device_id
- Add Device_ID 0xFF for all outputs active.

* remove debug counter

* update ci for refactor

* lint and clippy fixes

* docs: update pin mapping to match new pilot convention

* add clippy and more docs

* remove chaos mode

* docs: correct DIO IDs

* docs: output controller

* docs: add effect head positions for sign

* docs: add relay and solenoid connections to trace table

* docs: add control switch connections

* docs: rearrange table and fix table headings

* Limit input to MegaPoofer or Sign only
- this allows for common wiring

* update pin out
- match inputs to outputs
- common pins for mp and sign
- remove arm button

* Remap megapoofer pins to maintain hotline id to state bit relationship

* Adjust delays and remove debug statements
  • Loading branch information
twoshark authored Aug 4, 2024
1 parent 3890d00 commit ca6af51
Show file tree
Hide file tree
Showing 41 changed files with 2,373 additions and 75 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/rust_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
strategy:
fail-fast: false
matrix:
crate: ["relay", "wifi", "dc"]
crate: ["relay", "wifi", "dc", "input_controller", "output_controller"]
action:
# - command: check
# args: --target=xtensa-esp32-espidf --release
- command: check
args: --release
- command: fmt
args: --all -- --check --color always
# - command: clippy
# args: --target=xtensa-esp32-espidf --all-features --workspace -- -D warnings
- command: clippy
args: --all-features --workspace
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -37,7 +37,9 @@ jobs:
uses: Swatinem/rust-cache@v2
with:
workspaces: "relay/ -> target
wifi/ -> target"
wifi/ -> target
input_controller/ -> target
output_controller/ -> target
- name: Xtensa rustup target
run: espup install
- name: Source espup script
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ target/

# jetbrains
.idea
**/.idea

/.embuild
105 changes: 36 additions & 69 deletions dc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions docs/protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Hotline Protocol

This document defines the delimiters and commands for communication between a controller Arduino and digital output Arduino.

## Delimiters

| Name | Byte 0 | Byte 1 |
|-------|--------|--------|
| Start | 0xBE | 0xEF |
| End | 0xDE | 0xAD |

## Commands
### Variables
- $DEVICE_ID:
- 0xFF (broadcast)
- 0x00-0xFE (device ID)
- $DIO_STATE_0:
- Device States for Devices 0-7
- $DIO_STATE_1:
- Device States for Devices 8-15
- $CRC8
- Calculated CRC


| Name | Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 |
|----------------|--------|--------|------------|--------------|--------------|--------|--------|--------|
| Set Full State | 0xBE | 0xEF | $DEVICE_ID | $DIO_STATE_0 | $DIO_1_STATE | $CRC8 | 0xDE | 0xAD |
Loading

0 comments on commit ca6af51

Please sign in to comment.