hand_control/src/display.cpp

71 lines
2.1 KiB
C++
Raw Normal View History

2015-05-01 19:23:00 +00:00
#include <ncurses.h>
2015-05-02 13:37:58 +00:00
#include <string>
2015-05-01 21:22:13 +00:00
#include "display.h"
2015-05-01 19:23:00 +00:00
2015-05-02 13:37:58 +00:00
const int Curses::cmd_kbd_lines = 12;
const int Curses::cmd_kbd_columns = 50;
const int Curses::cmd_speed_lines = 4;
const int Curses::cmd_speed_columns = 50;
2015-05-01 19:23:00 +00:00
Curses::Curses() {
initscr();
cbreak();
2015-05-01 22:00:28 +00:00
//noecho();
2015-05-02 13:37:58 +00:00
cmd_kbd = newwin(cmd_kbd_lines, cmd_kbd_columns, 0, 0);
cmd_speed = newwin(cmd_speed_lines,
cmd_speed_columns, cmd_kbd_lines+1, 0);
get = newwin(1,1,cmd_kbd_lines + cmd_speed_lines + 1,2);
//log_sent_w = newwin(///
//nav_data = newwin(//
print_cmd_kbd();
print_cmd_speed();
2015-05-01 22:00:28 +00:00
wmove(get, 0, 0);
wrefresh(get);
2015-05-01 19:23:00 +00:00
}
Curses::~Curses() {
2015-05-02 13:37:58 +00:00
delwin(cmd_kbd);
delwin(cmd_speed);
delwin(log_sent_w);
delwin(nav_data);
2015-05-01 22:00:28 +00:00
delwin(get);
2015-05-01 19:23:00 +00:00
endwin();
}
2015-05-02 13:37:58 +00:00
char Curses::getchar() {
2015-05-01 22:00:28 +00:00
return wgetch(get);
}
2015-05-02 13:37:58 +00:00
void Curses::print_cmd_kbd() {
wmove(cmd_kbd, 0, 0); waddstr(cmd_kbd, " ---------------------");
wmove(cmd_kbd, 1, 0); waddstr(cmd_kbd, "takeoff>| t|⇑ y|↖ u|↑ i|↗ o|");
wmove(cmd_kbd, 2, 0); waddstr(cmd_kbd, " |---|---|---|---|---|----");
wmove(cmd_kbd, 3, 0); waddstr(cmd_kbd, " reset>| g|⇐ h|← j| k|→ l|⇒ m|");
wmove(cmd_kbd, 4, 0); waddstr(cmd_kbd, " |---|---|---|---|---|----");
wmove(cmd_kbd, 5, 0); waddstr(cmd_kbd, " land>| b|⇓ n|↙ ,|↓ ;|↘ :|");
wmove(cmd_kbd, 6, 0); waddstr(cmd_kbd, " ---------------------");
wmove(cmd_kbd, 8, 0); waddstr(cmd_kbd, "a/w : increase/decrease linear `x` speeds by 10%");
wmove(cmd_kbd, 9, 0); waddstr(cmd_kbd, "z/x : increase/decrease linear `y` speed by 10%");
wmove(cmd_kbd, 10, 0); waddstr(cmd_kbd, "e/c : increase/decrease linear `z` speed by 10%");
wmove(cmd_kbd, 11, 0); waddstr(cmd_kbd, "r/v : increase/decrease rotation speed by 10%");
wrefresh(cmd_kbd);
}
void Curses::print_cmd_speed() {
}
void Curses::update_cmd_speed(const char& coord, const float& v) {
}
void Curses::log_sent(const std::string& str) {
}
void Curses::update_navdata(const float& batteryPercent,
const int& state,
const float& time) {
2015-05-01 19:23:00 +00:00
}