summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-06-02 14:22:26 +0200
committerlonkaars <loek@pipeframe.xyz>2022-06-02 14:22:26 +0200
commit052be3db6fbb855be63e95291a270ba707796739 (patch)
tree0e807346307c47ec225b33e7e6d9488921843ada
parentd477e63d1968bea59afee7a9e69778952668c49e (diff)
fix pos/neg bar graph and control scheme
-rw-r--r--.gitignore2
-rw-r--r--client/ui_dirc.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 1b78506..fc7d087 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,4 @@ client/main
*.log
scripts/InstallationLog.txt
docs/
-robot/tty
+tty
diff --git a/client/ui_dirc.c b/client/ui_dirc.c
index 7720a4c..2965169 100644
--- a/client/ui_dirc.c
+++ b/client/ui_dirc.c
@@ -64,17 +64,17 @@ void w2_ui_bar_graph_pm(unsigned int y, unsigned int x, unsigned int width, doub
temp[i + 1] = i < hw ? ' ' : (i - hw) < (hw * value) ? '*' : ' ';
} else {
for (unsigned int i = 0; i < width; i++)
- temp[i + 1] = i < hw ? ' ' : (i - hw) < (hw * value) ? '*' : ' ';
+ temp[i + 1] = i > hw ? ' ' : (hw - i) < -(hw * value) ? '*' : ' ';
}
- mvaddnstr(y, x, temp, width);
+ mvaddnstr(y, x, temp, width + 2);
}
void w2_ui_dirc_paint(int left, int right) {
mvaddstr(4, 0, "left drive: ");
- w2_ui_bar_graph_pm(4, 13, g_w2_ui_width - 14, (double)left / 255);
+ w2_ui_bar_graph_pm(4, 13, g_w2_ui_width - 13, (double)left / 255);
mvaddstr(5, 0, "right drive: ");
- w2_ui_bar_graph_pm(5, 13, g_w2_ui_width - 14, (double)right / 255);
+ w2_ui_bar_graph_pm(5, 13, g_w2_ui_width - 13, (double)right / 255);
mvaddstr(7, 0,
" controls:\n"
@@ -92,10 +92,10 @@ void w2_ui_dirc(bool first) {
unsigned int rb = 0;
unsigned int rf = 0;
while ((ch = getch()) != -1) {
- if (ch == 'a' || ch == 's') lb++;
- if (ch == 'q' || ch == 'w') lf++;
- if (ch == 'd' || ch == 's') rb++;
- if (ch == 'e' || ch == 'w') rf++;
+ if (ch == 'e' || ch == 'w') lf++;
+ if (ch == 'd' || ch == 's') lb++;
+ if (ch == 'q' || ch == 'w') rf++;
+ if (ch == 'a' || ch == 's') rb++;
}
int drive_l = w2_dirc_motor_l(lf, lb);