Skip to content

Commit 7eab682

Browse files
committed
[SD] Add test for offline digital input
1 parent 3eac221 commit 7eab682

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

src/components/digitalIO/controller.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ bool DigitalIOController::Handle_DigitalIO_Add(pb_istream_t *stream) {
103103

104104
// Print out the pin's details
105105
WS_DEBUG_PRINTLN("[digitalio] Added new pin:");
106-
WS_DEBUG_PRINT("\tPin Name: ");
106+
WS_DEBUG_PRINT("Pin Name: ");
107107
WS_DEBUG_PRINTLN(new_pin.pin_name);
108-
WS_DEBUG_PRINT("\tPeriod: ");
108+
WS_DEBUG_PRINT("Period: ");
109109
WS_DEBUG_PRINTLN(new_pin.pin_period);
110-
WS_DEBUG_PRINT("\tSample Mode: ");
110+
WS_DEBUG_PRINT("Sample Mode: ");
111111
WS_DEBUG_PRINTLN(new_pin.sample_mode);
112-
WS_DEBUG_PRINT("\tDirection: ");
112+
WS_DEBUG_PRINT("Direction: ");
113113
WS_DEBUG_PRINTLN(new_pin.pin_direction);
114114

115115
return true;

tests/diagram.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"top": 9.2,
3737
"left": 74,
3838
"rotate": 270,
39-
"attrs": { "color": "green" }
39+
"attrs": { "bounce": "0", "color": "green" }
4040
},
4141
{ "type": "board-ds18b20", "id": "temp1", "top": -87.53, "left": 272.88, "attrs": {} },
4242
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Offline Mode - Digital Input
2+
version: 1
3+
author: Brent Rubell for Adafruit Industries
4+
5+
steps:
6+
- wait-serial: '[SD] Waiting for incoming JSON string...'
7+
- write-serial: '{"exportVersion":"1.0.0","exportedBy":"wokwi","exportedAt":"2024-10-28T18:58:23.976Z","exportedFromDevice":{"board":"metroesp32s3","firmwareVersion":"1.0.0-beta.93","referenceVoltage":2.6,"totalGPIOPins":11,"totalAnalogPins":6},"components":[{"componentAPI":"digitalio","name":"Button (D4)","pinName":"D4","type":"push_button","mode":"DIGITAL","sampleMode":"TIMER","direction":"INPUT","period":5,"pull":"UP","isPin":true}]}'
8+
- write-serial: '\n'
9+
- wait-serial: '[SD] Valid JSON string received!'
10+
- wait-serial: '[digitalio] Added new pin:'
11+
- wait-serial: 'Pin Name: 4'
12+
- wait-serial: 'Period: 5000'
13+
- wait-serial: 'Sample Mode: 1'
14+
- wait-serial: 'Direction: 2'
15+
- wait-serial: '{"timestamp":0,"pin":"A4","value":true,"si_unit":"BOOLEAN"}'
16+
- set-control:
17+
part-id: btn1
18+
control: pressed
19+
value: 1
20+
- wait-serial: '{"timestamp":0,"pin":"A4","value":false,"si_unit":"BOOLEAN"}'

0 commit comments

Comments
 (0)