{"id":1348,"date":"2024-06-15T19:01:57","date_gmt":"2024-06-15T17:01:57","guid":{"rendered":"https:\/\/www.domotic.phdata.fr\/domotic\/?p=1348"},"modified":"2024-06-16T06:41:19","modified_gmt":"2024-06-16T04:41:19","slug":"void-loop","status":"publish","type":"post","link":"https:\/\/www.domotic.phdata.fr\/domotic\/void-loop\/","title":{"rendered":"void loop"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">4 &#8211; Void (loop)<\/h1>\n\n\n\n<ul class=\"wp-block-list\"><\/ul>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\"><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cpp\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">void loop()\n{\n  while (SerialGPS.available() > 0)\n  {\n    if (gps.encode(SerialGPS.read()))\n    {\n      if (gps.date.isValid())\n      {\n        Day = gps.date.day();\n        Month = gps.date.month();\n        Year = gps.date.year();\n      }\n      if (gps.time.isValid())\n      {\n        Hour = gps.time.hour() + changement_heure; \/\/ ajuste UTC (heure hivers +1 - heure \u00e9t\u00e9 +2)\n        Minute = gps.time.minute();\n        Second = gps.time.second();\n      }\n      GestionZero(); \/\/ Ajout 0 si var &lt; 10\n\n      val_heure = zh + String(Hour) + \":\" + zmn + String(Minute) + \":\" + zs + String(Second);\n      val_date = String(Day) + \"\/\" + zmois + String(Month) + \"\/\" + String(Year);\n      total_mn_gps = (Hour) * 60 + Minute; \/\/ calcul nb total en minutes des heures du GPS\n    }\n  }\n\n  \/\/ ------------------------- Conversion des heures en minutes &amp; calcul tranche d\u00e9but fin --------------------------\n  if (T1_Debut_EV1 != \"\")\n  {\n    T1_Debut_EV1_Int = T1_Debut_EV1.toInt();\n  }\n\n  if (T1_Debut_M_EV1 != \"\")\n  {\n    T1_Debut_M_EV1_Int = T1_Debut_M_EV1.toInt();\n  }\n\n  if (T1_Nb_Cycle_EV1 != \"\")\n  {\n    Nb_Cycle_EV1_Int = T1_Nb_Cycle_EV1.toInt();\n  }\n\n  if (T1_Periode_Cycle_EV1 != \"\")\n  {\n    T1_Periode_Cycle_EV1_Int = T1_Periode_Cycle_EV1.toInt();\n  }\n\n  if (T1_Duree_Cycle_EV1 != \"\")\n  {\n    T1_Duree_Cycle_EV1_Int = T1_Duree_Cycle_EV1.toInt();\n  }\n\n  \/\/ ----------------------------------- traitement des tranches \u00e0 afficher sur la page web -----------------------------\n\n  T1M = \"\"; \/\/ Ajout 0 si mn entre 0et 9\n  if (T1_Debut_M_EV1_Int &lt; 10)\n  {\n    T1M = \"0\";\n  }\n  T1_Total_Debut_EV1 = T1_Debut_EV1_Int * 60 + T1_Debut_M_EV1_Int + T1_Periode_Cycle_EV1_Int * T1_Cpt_Nb_Cycle_EV1; \/\/ Conversion des heures en minutes\n  T1_Total_Fin_Cycle_EV1 = T1_Total_Debut_EV1 + T1_Duree_Cycle_EV1_Int;                                             \/\/ Calcul de la fin des cycles\n  if (T1_Total_Fin_Cycle_EV1 == total_mn_gps &amp;&amp; T1_Cpt_Nb_Cycle_EV1 &lt; Nb_Cycle_EV1_Int)                             \/\/ A la fin du cycle calcul le cycle suivant\n  {\n    T1_Cpt_Nb_Cycle_EV1++;\n  }\n\n  if (T1_Cpt_Nb_Cycle_EV1 == Nb_Cycle_EV1_Int)\n  {\n    T1_Cpt_Nb_Cycle_EV1 = 0;\n  }\n  \/\/------------------------------Gestion des cde de sortie \u00e9lectrovannes (PCF8475) -----------------------------\n  I_EV1 = PCF_21.read(7); \/\/ inter marche\/arr\u00eat forc\u00e9e EV1\n  I_EV2 = PCF_21.read(6); \/\/ inter march\/arr\u00eate forc\u00e9e EV2\n  I_EV3 = PCF_21.read(5); \/\/ inter marche\/arr\u00eat forc\u00e9e EV3\n  I_EV4 = PCF_21.read(4); \/\/ inter marche\/arr\u00eat forc\u00e9e EV4\n\n  if (inputMessage1 == \"4\" &amp;&amp; inputMessage2 == \"0\")\n  {\n    Mode_AM = 0;\n    inputMessage1 == \"\";\n  }\n\n  if (inputMessage1 == \"4\" &amp;&amp; inputMessage2 == \"1\")\n  {\n    Mode_AM = 1;\n    inputMessage1 == \"\";\n  }\n\n  \/\/* ----------------------- Marche\/Arr\u00eat mode manuel -----------------------\n  if (Mode_AM == 0)\n  {\n      val_out = 5; \/\/! permet de na pas activer les sortie de 0 \u00e0 4 (essai)\n      val_state = 0;\n    if (inputMessage1 == \"3\")\n    {\n      if (I_EV1 == 1 || inputMessage2 == \"1\")\n      {\n        PCF_21.write(S_EV1, 0); \/\/ Marche EV1\n      }\n      else if (I_EV1 == 0 || inputMessage2 == \"0\")\n      {\n        PCF_21.write(S_EV1, 1); \/\/  Arr\u00eat EV1\n      }\n    }\n\n    if (inputMessage1 == \"2\")\n    {\n      if (I_EV2 == 1 || inputMessage2 == \"1\")\n      {\n        PCF_21.write(S_EV2, 0); \/\/ Marche EV2\n      }\n      else if (I_EV2 == 0 || inputMessage2 == \"0\")\n      {\n        PCF_21.write(S_EV2, 1); \/\/  Arr\u00eat EV2\n      }\n    }\n    if (inputMessage1 == \"1\")\n    {\n      if (I_EV3 == 1 || inputMessage2 == \"1\")\n      {\n        PCF_21.write(S_EV3, 0); \/\/ Marche EV3\n      }\n      else if (I_EV3 == 0 || inputMessage2 == \"0\")\n      {\n        PCF_21.write(S_EV3, 1); \/\/  Arr\u00eat EV3\n      }\n    }\n    if (inputMessage1 == \"0\")\n    {\n      if (I_EV4 == 1 || inputMessage2 == \"1\")\n      {\n        PCF_21.write(S_EV4, 0); \/\/ Marche EV4\n      }\n      else if (I_EV4 == 0 || inputMessage2 == \"0\")\n      {\n        PCF_21.write(S_EV4, 1); \/\/  Arr\u00eat EV4\n      }\n    }\n  }\n\n  \/\/* ----------------------- Marche\/Arr\u00eat mode automatique -----------------------\n  if (Mode_AM == 1)\n  {\n    \/\/ if (((total_mn_gps >= T1_Total_Debut_EV1) &amp;&amp; (total_mn_gps &lt; T1_Total_Fin_Cycle_EV1)))\n    if (total_mn_gps >= T1_Total_Debut_EV1 &amp;&amp; total_mn_gps &lt; T1_Total_Fin_Cycle_EV1)\n    {\n      PCF_21.write(S_EV1, 0); \/\/ marche auto\n      val_out = 3;\n      val_state = 1;\n    }\n    else\n    {\n      PCF_21.write(S_EV1, 1); \/\/ arr\u00eat auto\n      val_out = 3;\n      val_state = 0;\n    }\n  }\n\n  affiche_ecran();\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>4 &#8211; Void (loop)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_canvas","format":"standard","meta":{"_eb_attr":"","ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[16],"tags":[15],"class_list":["post-1348","post","type-post","status-publish","format-standard","hentry","category-blog","tag-arrosage","entry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/posts\/1348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/comments?post=1348"}],"version-history":[{"count":2,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/posts\/1348\/revisions"}],"predecessor-version":[{"id":1350,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/posts\/1348\/revisions\/1350"}],"wp:attachment":[{"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/media?parent=1348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/categories?post=1348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.domotic.phdata.fr\/domotic\/wp-json\/wp\/v2\/tags?post=1348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}