aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pbdrv/pb-route.c7
-rw-r--r--lib/pbdrv/pb-send.c4
-rw-r--r--lib/pbdrv/pb-send.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/pbdrv/pb-route.c b/lib/pbdrv/pb-route.c
index df00cd3..709fb7f 100644
--- a/lib/pbdrv/pb-route.c
+++ b/lib/pbdrv/pb-route.c
@@ -64,9 +64,6 @@ __weak void pb_hook_module_init() {
}
__weak void pb_route_cmd_state_req(pb_msg_t * msg) {
pb_global_state_t own_state = pb_hook_mod_state_read();
- pb_buf_t buf = pb_send_state_res(own_state);
- pb_send_reply(msg, &buf);
- pb_buf_free(&buf);
// notify of new global state variable
pb_cmd_state_t * cmd = msg->cmd;
@@ -76,6 +73,10 @@ __weak void pb_route_cmd_state_req(pb_msg_t * msg) {
pb_hook_main_state_update(cmd->state);
}
_main_state = cmd->state;
+
+ pb_buf_t buf = pb_send_state_res();
+ pb_send_reply(msg, &buf);
+ pb_buf_free(&buf);
}
__weak void pb_route_cmd_state_res(pb_msg_t * msg) {}
diff --git a/lib/pbdrv/pb-send.c b/lib/pbdrv/pb-send.c
index 66c43c1..29d81ed 100644
--- a/lib/pbdrv/pb-send.c
+++ b/lib/pbdrv/pb-send.c
@@ -64,9 +64,9 @@ pb_buf_t pb_send_state_req() {
return pb_msg_write(&msg);
}
-pb_buf_t pb_send_state_res(pb_global_state_t state) {
+pb_buf_t pb_send_state_res() {
pb_cmd_state_t cmd = {
- .state = state,
+ .state = pb_hook_mod_state_read(),
};
pb_msg_t msg = {
.type = PB_CMD_STATE,
diff --git a/lib/pbdrv/pb-send.h b/lib/pbdrv/pb-send.h
index 2f8be1e..679df29 100644
--- a/lib/pbdrv/pb-send.h
+++ b/lib/pbdrv/pb-send.h
@@ -13,7 +13,7 @@ pb_buf_t pb_send_read_req(uint8_t propid);
pb_buf_t pb_send_read_res(uint8_t propid, uint8_t * value, size_t size);
pb_buf_t pb_send_write_req(uint8_t propid, uint8_t * value, size_t size);
pb_buf_t pb_send_state_req();
-pb_buf_t pb_send_state_res(pb_global_state_t state);
+pb_buf_t pb_send_state_res();
pb_buf_t pb_send_state_set(pb_global_state_t state);
pb_buf_t pb_send_magic_req();
pb_buf_t pb_send_magic_res();