aboutsummaryrefslogtreecommitdiff
path: root/robot
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-29 10:35:58 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-29 10:35:58 +0200
commit054cf1c2a433c87b7caee503c28db2b7005d1060 (patch)
tree7b60a739019a87228d4fb7fb320af88bed127f7f /robot
parentef8b97942d8d5cec956b75b6254e18034914e80d (diff)
fix order receiving
Diffstat (limited to 'robot')
-rw-r--r--robot/errcatch.c3
-rw-r--r--robot/mode_grid.c9
-rw-r--r--robot/sercomm.c6
3 files changed, 12 insertions, 6 deletions
diff --git a/robot/errcatch.c b/robot/errcatch.c
index 27026b5..3e62270 100644
--- a/robot/errcatch.c
+++ b/robot/errcatch.c
@@ -20,6 +20,7 @@ void w2_errcatch_display_error(uint8_t code) {
void w2_errcatch_error_beep(uint8_t code) {
if (code == W2_E_WARN_UNCAUGHT_ERROR) return;
+ if (code == W2_E_WARN_CYCLE_EXPIRED) return;
uint8_t severity = code & W2_E_TYPE_MASK;
if ((severity ^ W2_E_TYPE_CRIT) == 0) {
play("L70 O6 fRfRfRfRf");
@@ -48,6 +49,8 @@ void w2_errcatch_handle_error(w2_s_error *error) {
break;
case W2_E_WARN_BATTERY_LOW:
break;
+ case W2_E_WARN_CYCLE_EXPIRED:
+ break;
default: {
g_w2_error_uncaught = true;
#ifdef W2_SIM
diff --git a/robot/mode_grid.c b/robot/mode_grid.c
index ff80dd2..b6ed572 100644
--- a/robot/mode_grid.c
+++ b/robot/mode_grid.c
@@ -1,9 +1,13 @@
+#include <stdio.h>
+#include <string.h>
+
#include "mode_grid.h"
#include "hypervisor.h"
#include "io.h"
#include "modes.h"
#include "movement.h"
#include "orangutan_shim.h"
+#include "../shared/errcatch.h"
/**
* TODO: mode_grid g_w2_target_area laten volgen
@@ -204,6 +208,11 @@ void w2_turn_east() {
// signals when the product is picked
void w2_arrived_message() {
if (g_w2_location.x == g_w2_destination.x && g_w2_location.y == g_w2_destination.y) {
+ char msg[64];
+ sprintf(msg, "reached %i, %i", g_w2_destination.x, g_w2_destination.y);
+ size_t len = strlen(msg);
+ w2_errcatch_throw_msg(W2_E_INFO_ORDER_ARRIVED, len, msg);
+
play_frequency(400, 500, 7);
delay(500);
}
diff --git a/robot/sercomm.c b/robot/sercomm.c
index 16134d1..8df6157 100644
--- a/robot/sercomm.c
+++ b/robot/sercomm.c
@@ -118,17 +118,11 @@ void w2_cmd_dirc_rx(w2_s_bin *data) {
void w2_cmd_cord_rx(w2_s_bin *data) { return; }
-#include <stdio.h>
void w2_cmd_bomd_rx(w2_s_bin *data) {
W2_CAST_BIN(w2_s_cmd_bomd_rx, data, req);
req->position = w2_bin_hton32(req->position);
- char buf[32];
- clear();
- // sprintf(buf, "%lu, %lu", req->position % W2_MAP_DEFAULT_WIDTH, req->position / W2_MAP_DEFAULT_WIDTH);
- sprintf(buf, "%lu", req->position);
- print(buf);
g_w2_order[g_w2_order_index].x = req->position % W2_MAP_DEFAULT_WIDTH;
g_w2_order[g_w2_order_index].y = req->position / W2_MAP_DEFAULT_WIDTH;
g_w2_order_index++;