diff --git a/Photos_Videos/pieces_fini_dans_l_imprimante.jpg b/Photos_Videos/pieces_fini_dans_l_imprimante.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd38037013fe415abaf2b1feb66ea2c0df422b40 Binary files /dev/null and b/Photos_Videos/pieces_fini_dans_l_imprimante.jpg differ diff --git a/pousseseringue-arduino.cpp b/pousseseringue-arduino.cpp index 7bec42f4e8825d679e4c8b442ccc7f725532bf92..59521a1422965e52cfea4c078f68eae950d8aa8b 100644 --- a/pousseseringue-arduino.cpp +++ b/pousseseringue-arduino.cpp @@ -122,6 +122,8 @@ void setup() Serial.println(); Serial.println("Booting"); +web.PM("boot"); + #if !CORE_MOCK Wire.begin(); Wire.setClock(400000L); @@ -143,6 +145,8 @@ void setup() digitalWrite(SLEEP, 0); #endif // !CORE_MOCK +web.PM("boot2"); + #if 1 uint8_t mac[6]; @@ -159,6 +163,8 @@ void setup() } #endif +web.PM("boot3"); + // redirect everything to my AP ip: dnsServer.setErrorReplyCode(DNSReplyCode::NoError); @@ -170,6 +176,8 @@ void setup() Serial.printf("---> (or read IP address on screen)\n"); Serial.printf("connecting to ssid '%s'\n", STASSID); +web.PM("boot4"); + web.web_setup(); diff --git a/web.cpp b/web.cpp index 39a3487421c1635d787e5f5daa855bd0c40c697b..664781ba6803b147e923d47d6289c47edc5d60a0 100644 --- a/web.cpp +++ b/web.cpp @@ -6,10 +6,13 @@ void Web :: web_setup() { HeapSelectIram abc; +PM("1"); + pump_state_last_refresh_time = 0; remaining_duration_display_last_refresh_time = 0; set_theme(1); +PM("2"); colors[0] = color1; colors[1] = color2; @@ -174,7 +177,8 @@ void Web :: web_setup() microstep_configuration = ESPUI.addControl(ControlType::Number, "", "16", ControlColor::None, motor_steps_label, [&](Control* sender, int value){microstep_configuration_callback(sender, value);}); PM("Après toutes les features"); - } + + } // IRAM //Begin PM("Before style initialised"); @@ -221,7 +225,7 @@ uint16_t Web :: get_id_status_limit_switch() /************CALLBACK_METHODS****************/ -void Web :: lead_screw_pitch_mm_callback(Control* sender, int type) +void Web :: lead_screw_pitch_mm_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -243,7 +247,7 @@ void Web :: lead_screw_pitch_mm_callback(Control* sender, int type) //***ABOVE***// -void Web :: stop_syringe_pump_callback (Control* sender, int value) +void Web :: stop_syringe_pump_callback (Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -461,7 +465,7 @@ void Web :: confirm_initialisation_callback (Control *sender, int type) serial_print ("Confirm_initialisation", sender); } -void Web :: volume_exchange_mL_callback (Control* sender, int value) +void Web :: volume_exchange_mL_callback (Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -512,7 +516,7 @@ void Web :: throughput_or_duration_callback (Control *sender, int type) serial_print ("throughput_or_duration", sender); } -void Web :: exchange_throughtput_uL_per_min_or_duration_sec_callback (Control* sender, int value) +void Web :: exchange_throughtput_uL_per_min_or_duration_sec_callback (Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -578,7 +582,7 @@ void Web :: push_pull_choice_callback (Control* sender, int type) Serial.println(""); } -void Web :: remaining_volume_mL_callback (Control* sender, int value) +void Web :: remaining_volume_mL_callback (Control*, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -588,7 +592,7 @@ void Web :: remaining_volume_mL_callback (Control* sender, int value) ESPUI.updateSlider(remaining_volume_mL, syringe_filled.get_remaining_volume_mL()); } -void Web :: remaining_duration_sec_callback (Control* sender, int value) +void Web :: remaining_duration_sec_callback (Control*, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -630,7 +634,7 @@ void Web :: start_exchange_callback (Control* sender, int type) //configurations = Configurations -void Web :: initial_volume_mL_callback (Control* sender, int value) +void Web :: initial_volume_mL_callback (Control* sender, int) { syringe_filled.set_remaining_volume_mL((sender->value).toFloat()); syringe_filled.save_json(); @@ -683,7 +687,7 @@ void Web :: choose_syringe_callback (Control* sender, int value) } -void Web :: load_syringe_json_callback (Control* sender, int value) +void Web :: load_syringe_json_callback (Control*, int value) /*** -Argument : / -Return : / @@ -714,7 +718,7 @@ void Web :: load_syringe_json_callback (Control* sender, int value) -void Web :: name_new_syringe_callback(Control* sender, int type) +void Web :: name_new_syringe_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -727,7 +731,7 @@ void Web :: name_new_syringe_callback(Control* sender, int type) } -void Web :: total_volume_mL_new_syringe_callback(Control* sender, int type) +void Web :: total_volume_mL_new_syringe_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -740,7 +744,7 @@ void Web :: total_volume_mL_new_syringe_callback(Control* sender, int type) } -void Web :: internal_diameter_mm_new_syringe_callback(Control* sender, int type) +void Web :: internal_diameter_mm_new_syringe_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -782,7 +786,7 @@ void Web :: save_syringe_callback (Control* sender, int value) //features : Configurations avancées -void Web :: syringe_pump_length_mm_callback(Control* sender, int type) +void Web :: syringe_pump_length_mm_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -840,7 +844,7 @@ void Web :: clockwise_equals_forward_callback(Control* sender, int type) Serial.println(""); } -void Web :: microstep_configuration_callback(Control* sender, int type) +void Web :: microstep_configuration_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -859,7 +863,7 @@ void Web :: microstep_configuration_callback(Control* sender, int type) Serial.println(""); } -void Web :: motor_steps_callback(Control* sender, int type) +void Web :: motor_steps_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -921,7 +925,7 @@ void Web :: motor_release_callback(Control* sender, int type) Serial.println(""); } -void Web :: syringe_selection_callback(Control* sender, int value) +void Web :: syringe_selection_callback(Control* sender, int) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -945,7 +949,7 @@ void Web :: full_style(uint16_t id, int style) -Action : Change style (1 is active, green; 2 is inactive, red; 3 is neutral, brown) ***/ { - +PM("avant fullstyle"); switch (style) { case 1: @@ -969,7 +973,7 @@ void Web :: full_style(uint16_t id, int style) break; } - +PM("apres fullstyle"); } void Web :: part_style(uint16_t id, int style) @@ -979,7 +983,7 @@ void Web :: part_style(uint16_t id, int style) -Action : Change style (1 is active, green; 2 is inactive, red; 3 is neutral, brown) ***/ { - +PM("avant partstyle"); switch (style) { case 1: @@ -999,7 +1003,7 @@ void Web :: part_style(uint16_t id, int style) break; } - +PM("apres partstyle"); } void Web :: set_initial_style() @@ -1186,7 +1190,7 @@ void Web :: style_exchange_configuration(int style_choice) } - void Web :: style_current_exchange_features(int style_choice) + void Web :: style_current_exchange_features(int /*style_choice*/) { full_style(label_remaining_volume_mL, 3); part_style(remaining_volume_mL, 3); @@ -1234,7 +1238,7 @@ void Web :: motor_release_action() digitalWrite(SLEEP, HIGH); } -void Web :: serial_print (String name, Control* sender) +void Web :: serial_print (const String& name, Control* sender) { Serial.println(name); Serial.println(String("Value: ") + String(sender->type)); @@ -1246,32 +1250,32 @@ void Web :: serial_print (String name, Control* sender) //Memory debugging -void Web :: printHeap (const char* where, const char* what, size_t limit) +void Web :: printHeap (const __FlashStringHelper* where, const __FlashStringHelper* what, size_t limit) { uint32_t hfree; uint32_t hmax; uint8_t hfrag; ESP.getHeapStats(&hfree, &hmax, &hfrag); - if (hmax < limit) - Serial.printf("%s: %s: free=%u max=%u frag=%u%%\n", where, what, hfree, hfrag); +// if (hmax < limit) + Serial.printf("%s: %s: free=%u max=%u frag=%u%%\n", (const char*)where, (const char*)what, hfree, hmax, hfrag); } -void Web :: PM (const char* where) +void Web :: PMf (const __FlashStringHelper* where) { { HeapSelectIram useInstructionRamHere; - printHeap(where, "IRAM", 2000); + printHeap(where, F("IRAM"), 2000); } { HeapSelectDram useRegularRamHere; - printHeap(where, "DRAM", 10000); + printHeap(where, F("DRAM"), 10000); } } //WEB_LOOP// void Web :: web_loop() { - if(millis() > pump_state_last_refresh_time + 40) + if(millis() > pump_state_last_refresh_time + 1000) { pump_state_last_refresh_time = millis(); diff --git a/web.h b/web.h index f7c2eccfdd5d0e3fb2cc30844c344013ca2490a2..58c39be15dc41c67192dd1d152827820dfd1a1ab 100644 --- a/web.h +++ b/web.h @@ -77,7 +77,7 @@ private : uint16_t new_syringe; uint16_t name_new_syringe_label, name_new_syringe; - String name_new_syringe_value; + String name_new_syringe_value; uint16_t internal_diameter_mm_new_syringe_label, internal_diameter_mm_new_syringe; String internal_diameter_mm_new_syringe_value; @@ -118,8 +118,6 @@ public : /************METHODS****************/ - void number_max_min(int min, int max, uint16_t control); - //***ALWAYS_VISIBLE***// void stop_syringe_pump_callback (Control* sender, int value); @@ -134,7 +132,6 @@ uint16_t get_id_status_limit_switch(); void slow_backward_callback (Control *sender, int type); void slow_forward_callback (Control *sender, int type); void fast_forward_callback (Control *sender, int type); - void motor_release_action(); void confirm_initialisation_callback (Control *sender, int type); //Exchange configuration @@ -149,7 +146,6 @@ uint16_t get_id_status_limit_switch(); //Configurations void syringe_selection_callback(Control* sender, int value); - void select_syringe_update(uint16_t tab); void load_syringe_json_callback (Control* sender, int value); void choose_syringe_callback(Control* sender, int value); @@ -184,12 +180,21 @@ uint16_t get_id_status_limit_switch(); void style_calibration(int style_choice); void style_exchange_configuration(int style_choice); void style_current_exchange_features(int style_choice); - void serial_print(String name, Control* sender); -//Memory debugging -void printHeap(const char* where, const char* what, size_t limit); -void PM(const char* where); +//OTHER_METHODS + void select_syringe_update(uint16_t tab); + void number_max_min(int min, int max, uint16_t control); + void motor_release_action(); + void serial_print (const String& name, Control* sender); + + +//Debugage de la mémoire + +static void printHeap (const __FlashStringHelper* where, const __FlashStringHelper* what, size_t limit); +static void PMf (const __FlashStringHelper* where); + +#define PM(x) PMf(F(x)) //Webloop void web_loop();