diff --git a/lib/M5LCD/src/M5LCD.h b/lib/M5LCD/src/M5LCD.h index 00de43c..ff53c1b 100644 --- a/lib/M5LCD/src/M5LCD.h +++ b/lib/M5LCD/src/M5LCD.h @@ -60,6 +60,7 @@ public: void set_product_label(std::string str); void set_product_id(std::string str); void set_servo_message(std::string str); + int _current_page; private: void update_page() const; void show_debug() const; @@ -68,7 +69,6 @@ private: void update_pagination() const; void update_dashboard() const; - int _current_page; int _debug_loc_y; std::vector _logs; ComponentsStatus _components_status; diff --git a/src/Program.cpp b/src/Program.cpp index 0067723..f9e61b0 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -83,6 +83,7 @@ Program::Program() { this->outputReader = new BigNfcReader(); this->outputReader->init(); this->grblUpdateTime = 0; + lcdScreen->set_grbl_status(COMPONENT_OK); Wire.begin(21, 22); grbl->init(STEPER_SPEED, STEPER_PAS, STEPER_ACC); struct WifiConfig wifi_c = {WIFI_SSID, WIFI_PASSWORD}; @@ -105,7 +106,7 @@ void Program::loop() { if(this->outputReader->getNbTags() >= 2){ lcdScreen->set_nfc_message("To mutch colis number detected"); - return; + lcdScreen->set_grbl_status(COMPONENT_KO); } String nfcId = this->nfcReader->ReadNfc(); @@ -163,10 +164,12 @@ void Program::loop() { } this->grbl->mouveForward(CONVOYER_LEN); } else { - if(this->grbl->isIddle() || (maintenant - this->grblUpdateTime >= GRBL_UPDATE)){ + if((this->grbl->isIddle() || (maintenant - this->grblUpdateTime >= GRBL_UPDATE)) && lcdScreen->get_components().grbl == COMPONENT_OK){ this->grblUpdateTime = maintenant; this->grbl->mouveForward(5); - Serial.print("pouet"); } } + if(M5.BtnC.wasReleased() != 0 && lcdScreen->_current_page == DASHBOARD_SCREEN){ + lcdScreen->set_grbl_status(COMPONENT_OK); + } }