aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/time.h2
-rw-r--r--client/ui.c6
-rw-r--r--client/ui_dirc.c54
3 files changed, 31 insertions, 31 deletions
diff --git a/client/time.h b/client/time.h
index 30c8124..a989c5c 100644
--- a/client/time.h
+++ b/client/time.h
@@ -4,7 +4,7 @@
#define W2_CLIENT_TIMER_COUNT (4)
extern unsigned long g_w2_client_timers[W2_CLIENT_TIMER_COUNT];
typedef enum {
- W2_TIMER_PING = 0,
+ W2_TIMER_PING = 0,
W2_TIMER_UPDATE = 1,
} w2_e_client_timers;
diff --git a/client/ui.c b/client/ui.c
index 999e4eb..ca96efb 100644
--- a/client/ui.c
+++ b/client/ui.c
@@ -7,12 +7,12 @@
#include "main.h"
#include "strings.h"
#include "term.h"
-#include "ui.h"
#include "time.h"
+#include "ui.h"
WINDOW *g_w2_ui_win;
-unsigned int g_w2_ui_width = 0;
-unsigned int g_w2_ui_height = 0;
+unsigned int g_w2_ui_width = 0;
+unsigned int g_w2_ui_height = 0;
void (*g_w2_ui_current_tab)() = &w2_ui_dirc;
void w2_ui_main() {
diff --git a/client/ui_dirc.c b/client/ui_dirc.c
index 61abaf4..118a3ea 100644
--- a/client/ui_dirc.c
+++ b/client/ui_dirc.c
@@ -4,49 +4,49 @@
void w2_ui_bar_graph(unsigned int percent) {
unsigned int width = g_w2_ui_width - 7;
char bar[width];
- for(unsigned int i = 0; i < width - 2; i++) {
- bar[i+1] = i > (width - 2) * percent / 100 ? ' ' : '*';
+ for (unsigned int i = 0; i < width - 2; i++) {
+ bar[i + 1] = i > (width - 2) * percent / 100 ? ' ' : '*';
}
- bar[0] = '|';
+ bar[0] = '|';
bar[width - 1] = '|';
mvaddnstr(4, 7, bar, width);
}
-#define W2_DIRC_MOD ((double) 0.95)
-#define W2_DIRC_ADD ((double) 13.0)
-#define W2_DIRC_PAD ((double) 1.10)
-#define W2_DIRC_SPL ((unsigned int) 20)
+#define W2_DIRC_MOD ((double)0.95)
+#define W2_DIRC_ADD ((double)13.0)
+#define W2_DIRC_PAD ((double)1.10)
+#define W2_DIRC_SPL ((unsigned int)20)
-int w2_avg(int* samples, unsigned int sample_count) {
+int w2_avg(int *samples, unsigned int sample_count) {
double total = 0;
for (int i = 0; i < sample_count; i++) {
- total += (double) samples[i] / (double) sample_count;
+ total += (double)samples[i] / (double)sample_count;
}
- return (int) total;
+ return (int)total;
}
-#define W2_DIRC_MOTOR_DRIVER(name) \
-int w2_dirc_motor_##name(unsigned int forward, unsigned int backward) {\
- static unsigned int idx = 0;\
- \
- static double drive = 0.f;\
- static int drive_avg[W2_DIRC_SPL] = {0};\
- \
- drive *= W2_DIRC_MOD;\
- drive += W2_DIRC_ADD * forward + -W2_DIRC_ADD * backward;\
- drive = W2_RANGE(-254, drive, 255);\
- \
- idx = (idx + 1) % W2_DIRC_SPL;\
- drive_avg[idx] = (int) W2_RANGE(-254, drive * W2_DIRC_PAD, 255);\
- \
- return w2_avg(drive_avg, W2_DIRC_SPL);\
-}
+#define W2_DIRC_MOTOR_DRIVER(name) \
+ int w2_dirc_motor_##name(unsigned int forward, unsigned int backward) { \
+ static unsigned int idx = 0; \
+ \
+ static double drive = 0.f; \
+ static int drive_avg[W2_DIRC_SPL] = {0}; \
+ \
+ drive *= W2_DIRC_MOD; \
+ drive += W2_DIRC_ADD * forward + -W2_DIRC_ADD * backward; \
+ drive = W2_RANGE(-254, drive, 255); \
+ \
+ idx = (idx + 1) % W2_DIRC_SPL; \
+ drive_avg[idx] = (int)W2_RANGE(-254, drive * W2_DIRC_PAD, 255); \
+ \
+ return w2_avg(drive_avg, W2_DIRC_SPL); \
+ }
W2_DIRC_MOTOR_DRIVER(l);
W2_DIRC_MOTOR_DRIVER(r);
void w2_ui_dirc() {
- int ch = 0;
+ int ch = 0;
unsigned int lb = 0;
unsigned int lf = 0;
unsigned int rb = 0;