aboutsummaryrefslogtreecommitdiff
path: root/robot/hypervisor.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-14 00:49:58 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-14 00:49:58 +0200
commitd9df6e65017e9f4409b33a13e4aa62f37e685946 (patch)
treef672c3b3ea4c97b83a955bf628fc0d9d60cdd144 /robot/hypervisor.c
parent3f90c242ff00cc2a8ec26486c1d22bb0e3de0114 (diff)
error handling done + better simulation / debug messaging
Diffstat (limited to 'robot/hypervisor.c')
-rw-r--r--robot/hypervisor.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/robot/hypervisor.c b/robot/hypervisor.c
index 0350163..2e263ce 100644
--- a/robot/hypervisor.c
+++ b/robot/hypervisor.c
@@ -1,15 +1,10 @@
-#include <stdlib.h>
-#include <time.h>
-#include <stdio.h>
-#include <unistd.h>
-
#include "consts.h"
#include "errcatch.h"
#include "hypervisor.h"
#include "io.h"
#include "modes.h"
-#include "sercomm.h"
#include "orangutan_shim.h"
+#include "sercomm.h"
void w2_hypervisor_main() {
time_reset();
@@ -23,20 +18,14 @@ void w2_hypervisor_main() {
w2_modes_main();
unsigned long mode_time = get_ms() - io_time;
- char* message = malloc(80);
- sprintf(message, "sercomm: %lums ", sercomm_time);
- serial_send(message, 80);
- sprintf(message, "errcatch: %lums ", errcatch_time);
- serial_send(message, 80);
- sprintf(message, "io: %lums ", io_time);
- serial_send(message, 80);
- sprintf(message, "mode: %lums ", mode_time);
- serial_send(message, 80);
- sprintf(message, " ");
- serial_send(message, 80);
- free(message);
+ #ifdef W2_SIM
+ siminfo("sercomm: %lums\n", sercomm_time);
+ siminfo("errcatch: %lums\n", errcatch_time);
+ siminfo("io: %lums\n", io_time);
+ siminfo("mode: %lums\n", mode_time);
usleep(100e3);
+ #endif
if (mode_time > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_ERR_CYCLE_EXPIRED);
}