From 261eca7b454fffefe3f1a8b639d6789f9942853c Mon Sep 17 00:00:00 2001 From: dufourj Date: Thu, 25 May 2006 20:04:31 +0000 Subject: Es : - LCD management. --- i/marvin/src/es/es.cc | 7 ++----- i/marvin/src/es/es.hh | 2 +- i/marvin/src/proto/proto.cc | 12 +++++++----- i/marvin/src/proto/proto.hh | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) (limited to 'i') diff --git a/i/marvin/src/es/es.cc b/i/marvin/src/es/es.cc index 4d541ef..86bbb3b 100644 --- a/i/marvin/src/es/es.cc +++ b/i/marvin/src/es/es.cc @@ -116,8 +116,6 @@ Es::reset (void) setRVBSniffFrontStat (rvbSniffFrontStat_); lcdGetKey (lcdKeyStat_); - lcdPrint ("I'm ready Tb!"); - enableAllSensors (true); log_ ("Es", Log::debug) << "Reset Es done."; } @@ -252,11 +250,10 @@ Es::setSharpThreshold (int sharp_num, int threshold_high, void Es::lcdPrint (const std::string &message) { - // XXX Yerk ! - std::memset (lcd_mess_char_, '\0', 17); + std::memset (lcd_mess_char_, ' ', 16); int size = message.size (); std::memcpy (lcd_mess_char_, message.data (), size > 16 ? 16 : size); - proto_.send ('l', lcd_mess_char_, 16); + proto_.sendStr ('l', lcd_mess_char_, 16); } /// Get the current pressed keys of the LCD diff --git a/i/marvin/src/es/es.hh b/i/marvin/src/es/es.hh index 5eb8d89..8abcca4 100644 --- a/i/marvin/src/es/es.hh +++ b/i/marvin/src/es/es.hh @@ -50,7 +50,7 @@ class Es : public Proto::Receiver /// Système de log Log log_; /// For LCD communication - char lcd_mess_char_[17]; + char lcd_mess_char_[16]; /// Key pressed by the LCD Keyboard int lcdKeyPressed_, lcdKeyStat_; /// Frontal choc ! diff --git a/i/marvin/src/proto/proto.cc b/i/marvin/src/proto/proto.cc index 1bc560f..216a345 100644 --- a/i/marvin/src/proto/proto.cc +++ b/i/marvin/src/proto/proto.cc @@ -59,7 +59,7 @@ Proto::sync(void) // Récupération de la frame while (getFrame()) { -// log_ ("recv", Log::debug) << "frame" << currentFrame_; + log_ ("recv", Log::debug) << "frame" << currentFrame_; // Si la frame est un aquittement if(currentFrame_ == frameQueue_.front()) { @@ -137,9 +137,11 @@ Proto::send (char command, const char *format, int a0, int a1, /// Send a string of size number. void -Proto::send (char command, const std::string &str, int size, bool reliable) +Proto::sendStr (char command, const char *str, int size, bool reliable) { Proto::Frame frame; + + frame.command = command; for (int compt = 0; compt < size; compt++) newArgFrame (frame, 'b', str[compt]); @@ -287,8 +289,8 @@ Proto::getFrame(void) { // On renvoie en mettant le compteur à 0, la commande sera // renvoyer de retour à sync -// log_("Erreur de reception", Log::debug) -// << "commande inconnue" << ""; + log_("Erreur de reception", Log::debug) + << "commande inconnue" << ""; tLastSend_ = 0; revState_ = 0; return false; @@ -301,7 +303,7 @@ Proto::getFrame(void) void Proto::sendFrame(const Frame & frame) { -// log_ ("send", Log::debug) << "frame" << frame; + log_ ("send", Log::debug) << "frame" << frame; // envoyer le bang serial_.putchar('!'); diff --git a/i/marvin/src/proto/proto.hh b/i/marvin/src/proto/proto.hh index 4e1f24c..8979a3d 100644 --- a/i/marvin/src/proto/proto.hh +++ b/i/marvin/src/proto/proto.hh @@ -84,7 +84,7 @@ class Proto : public NonCopyable void send (char command, const char *format = "", int a0 = 0, int a1 = 0, int a2 = 0, int a3 = 0, int a4 = 0, int a5 = 0, bool reliable = true); /// Send a string of size number. - void send (char command, const std::string &str, int size, bool reliable = + void sendStr (char command, const char *str, int size, bool reliable = true); /// permet d'envoyer un packet robert void Proto::sendUnreliable (char command, const char *format, int a0, -- cgit v1.2.3