Skip to content

Commit 11c37d0

Browse files
authored
Merge pull request #482 from tock/thread-fixes
thread tutorial fixes
2 parents 8aaebcc + 232e34d commit 11c37d0

File tree

8 files changed

+15
-16
lines changed

8 files changed

+15
-16
lines changed

examples/tutorials/thread_network/06_screen/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TOCK_USERLAND_BASE_DIR = ../../../../
66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
88

9-
PACKAGE_NAME = screen
9+
PACKAGE_NAME = screen
1010

1111
# Include userland master makefile. Contains rules and flags for actually
1212
# building the application.

examples/tutorials/thread_network/07_screen_button/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TOCK_USERLAND_BASE_DIR = ../../../../
66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
88

9-
PACKAGE_NAME = screen
9+
PACKAGE_NAME = screen
1010

1111
# Include userland master makefile. Contains rules and flags for actually
1212
# building the application.

examples/tutorials/thread_network/08_screen_u8g2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TOCK_USERLAND_BASE_DIR = ../../../../
66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
88

9-
PACKAGE_NAME = screen
9+
PACKAGE_NAME = screen
1010

1111
STACK_SIZE = 4096
1212
EXTERN_LIBS += $(TOCK_USERLAND_BASE_DIR)/u8g2

examples/tutorials/thread_network/09_screen_final/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TOCK_USERLAND_BASE_DIR = ../../../../
66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
88

9-
PACKAGE_NAME = screen
9+
PACKAGE_NAME = screen
1010

1111
STACK_SIZE = 4096
1212
EXTERN_LIBS += $(TOCK_USERLAND_BASE_DIR)/u8g2

examples/tutorials/thread_network/09_screen_final/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int main(void) {
5050
}
5151

5252
for ( ;;) {
53+
callback_event = false;
5354
yield_for(&callback_event);
5455
update_screen();
5556
}

examples/tutorials/thread_network/10_screen_ipc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TOCK_USERLAND_BASE_DIR = ../../../../
66
# Which files to compile.
77
C_SRCS := $(wildcard *.c)
88

9-
PACKAGE_NAME = screen
9+
PACKAGE_NAME = screen
1010

1111
STACK_SIZE = 4096
1212
EXTERN_LIBS += $(TOCK_USERLAND_BASE_DIR)/u8g2

examples/tutorials/thread_network/10_screen_ipc/main.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,19 @@ static int init_controller_ipc(void) {
192192

193193
if (err_sensor < 0) {
194194
printf("No sensor service\r\n");
195-
return -1;
195+
} else {
196+
printf("[controller] Discovered sensor service: %d\r\n", sensor_svc_num);
197+
ipc_register_client_callback(sensor_svc_num, sensor_callback, NULL);
198+
ipc_share(sensor_svc_num, &temperature_buffer, sizeof(temperature_buffer));
196199
}
197200

198201
if (err_openthread < 0) {
199202
printf("No openthread service\r\n");
200-
return -1;
203+
} else {
204+
printf("[controller] Discovered openthread service: %d\r\n", openthread_svc_num);
205+
ipc_register_client_callback(openthread_svc_num, openthread_callback, NULL);
206+
ipc_share(openthread_svc_num, &openthread_buffer, sizeof(openthread_buffer));
201207
}
202208

203-
printf("[controller] Discovered sensor service: %d\r\n", sensor_svc_num);
204-
printf("[controller] Discovered openthread service: %d\r\n", openthread_svc_num);
205-
206-
ipc_register_client_callback(sensor_svc_num, sensor_callback, NULL);
207-
ipc_register_client_callback(openthread_svc_num, openthread_callback, NULL);
208-
209-
ipc_share(sensor_svc_num, &temperature_buffer, sizeof(temperature_buffer));
210-
ipc_share(openthread_svc_num, &openthread_buffer, sizeof(openthread_buffer));
211-
212209
return err;
213210
}

examples/tutorials/thread_network/11_sensor_ipc/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static void sensor_ipc_callback(int pid, int len, int buf,
1515
if (len < ((int) sizeof(current_temperature))) {
1616
// We do not inform the caller and simply return. We do print a log message:
1717
puts("[thread-sensor] ERROR: sensor IPC invoked with too small buffer.\r\n");
18+
return;
1819
}
1920

2021
// The buffer is large enough, copy the current temperature into it:

0 commit comments

Comments
 (0)