adds sent commands log

This commit is contained in:
Louis-Guillaume DUBOIS 2015-05-02 19:24:54 +02:00
parent 454b0acd65
commit f211313cd5
2 changed files with 42 additions and 8 deletions

View file

@ -4,21 +4,44 @@
const int Curses::cmd_kbd_lines = 12; const int Curses::cmd_kbd_lines = 12;
const int Curses::cmd_kbd_columns = 50; const int Curses::cmd_kbd_columns = 50;
const int Curses::cmd_speed_lines = 4; const int Curses::cmd_speed_lines = 4;
const int Curses::cmd_speed_columns = 50; const int Curses::cmd_speed_columns = 50;
const int Curses::get_lines = 1;
const int Curses::get_columns = 1;
const int Curses::nav_data_lines = 5;
const int Curses::nav_data_columns = 40;
const int Curses::log_sent_w_lines = 12;
const int Curses::log_sent_w_columns = 40;
Curses::Curses() { Curses::Curses() {
initscr(); initscr();
cbreak(); cbreak();
//noecho(); //noecho();
cmd_kbd = newwin(cmd_kbd_lines, cmd_kbd_columns, 0, 0); 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(get_lines, get_columns,
get = newwin(1,1,cmd_kbd_lines + cmd_speed_lines + 1,2); cmd_kbd_lines, cmd_kbd_columns/2);
//log_sent_w = newwin(///
//nav_data = newwin(// cmd_speed = newwin(cmd_speed_lines, cmd_speed_columns,
cmd_kbd_lines + get_lines, 0);
log_sent_w = newwin(log_sent_w_lines, log_sent_w_columns,
0, cmd_kbd_columns + 1);
log_line_number = log_sent_w_lines - 1;
scrollok(log_sent_w, TRUE);
nav_data = newwin(nav_data_lines, nav_data_columns,
log_sent_w_lines + 1, cmd_kbd_columns + 1);
print_cmd_kbd(); print_cmd_kbd();
print_cmd_speed(); print_cmd_speed();
wmove(get, 0, 0); wmove(get, 0, 0);
wrefresh(get); wrefresh(get);
} }
@ -60,7 +83,9 @@ void Curses::update_cmd_speed(const char& coord, const float& v) {
} }
void Curses::log_sent(const std::string& str) { void Curses::log_sent(const std::string& str) {
wmove(log_sent_w, log_line_number++, 0);
waddstr(log_sent_w, (str + "\n").c_str() );
wrefresh(log_sent_w);
} }
void Curses::update_navdata(const float& batteryPercent, void Curses::update_navdata(const float& batteryPercent,

View file

@ -10,15 +10,24 @@ class Curses
static const int cmd_kbd_lines; static const int cmd_kbd_lines;
static const int cmd_kbd_columns; static const int cmd_kbd_columns;
WINDOW* cmd_kbd; WINDOW* cmd_kbd;
void print_cmd_kbd();
static const int cmd_speed_lines; static const int cmd_speed_lines;
static const int cmd_speed_columns; static const int cmd_speed_columns;
WINDOW* cmd_speed; WINDOW* cmd_speed;
void print_cmd_kbd();
void print_cmd_speed(); void print_cmd_speed();
static const int get_lines;
static const int get_columns;
WINDOW* get; WINDOW* get;
// TODO (avec scroll) static const int log_sent_w_lines;
static const int log_sent_w_columns;
int log_line_number;
WINDOW* log_sent_w; WINDOW* log_sent_w;
static const int nav_data_lines;
static const int nav_data_columns;
WINDOW* nav_data; WINDOW* nav_data;
public: public: