Skip to content

Commit f02a2c1

Browse files
author
Jarkko Paso
authored
Check if RELAY pin is configured before controlling (#283)
1 parent 38b8db1 commit f02a2c1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

mesh_led_control_example.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,22 @@ static void update_state(uint8_t state) {
110110
tr_debug("Turning led on\n");
111111
led_1 = 0;
112112
button_status=1;
113-
output = 0;
113+
if (MBED_CONF_APP_RELAY_CONTROL != NC) {
114+
output = 0;
115+
} else {
116+
printf("Pins not configured. Skipping the RELAY control.\n");
114117
}
118+
}
115119
else {
116120
tr_debug("Turning led off\n");
117121
led_1 = 1;
118122
button_status=0;
119-
output = 1;
120-
}
123+
if (MBED_CONF_APP_RELAY_CONTROL != NC) {
124+
output = 1;
125+
} else {
126+
printf("Pins not configured. Skipping the RELAY control.\n");
127+
}
128+
}
121129
}
122130

123131
static void handle_message(char* msg) {

0 commit comments

Comments
 (0)