"""Module 0 — Prérequis & installation.""" from outils import boite, chronogramme, fleche, toile from style import BLEU, ENCRE, GRIS, ORANGE, VERT, Figure def chaine_developpement(): fig, ax = toile(16, 5.6) # Zones ordinateur / carte boite(ax, 5.0, 3.0, 9.4, 4.6, couleur=GRIS, fond="#f9fafb") boite(ax, 13.2, 3.0, 4.6, 4.6, couleur=BLEU, fond="#f5f8fe") ax.text(0.6, 4.8, "Ordinateur — Arduino IDE", fontsize=9, color=GRIS, fontweight="bold") ax.text(11.2, 4.8, "Carte ESP32-S3", fontsize=9, color=BLEU, fontweight="bold") code = boite(ax, 2.0, 3.3, 2.6, 1.4, "Croquis\n(.ino)", couleur=BLEU) comp = boite(ax, 5.6, 3.3, 2.6, 1.4, "Compilation\n✓ Vérifier", couleur=BLEU) moni = boite(ax, 4.2, 1.4, 5.4, 0.9, "Moniteur série — 115200 bauds", couleur=VERT, taille=8.5) flash = boite(ax, 13.2, 3.3, 3.2, 1.4, "Mémoire Flash\n(programme)", couleur=ORANGE) cpu = boite(ax, 13.2, 1.4, 3.2, 0.9, "Exécution", couleur=ORANGE) fleche(ax, code["d"], comp["g"]) fleche(ax, comp["d"], flash["g"], "Téléverser →\n(câble USB)", taille=8) fleche(ax, flash["b"], cpu["h"]) fleche(ax, cpu["g"], moni["d"], "Serial.println()", couleur=VERT, taille=8) ax.text(8.0, 0.1, "Le même câble USB sert au téléversement et au moniteur série (USB CDC).", ha="center", fontsize=7.5, color=GRIS, style="italic") return fig def boot_reset(): voies = [ ("BOOT", [(0, 1), (1, 0), (4, 1)]), ("RESET", [(0, 1), (2, 0), (2.6, 1)]), ] fig, ax, y = chronogramme(voies, 6, largeur_cm=15, hauteur_voie_cm=1.6, couleurs={"RESET": ORANGE}) ax.set_xticks([]) ax.spines["bottom"].set_visible(False) for i in range(2): ax.text(6.05, y(i) + 1, "relâché", fontsize=7, color=GRIS, va="center") ax.text(6.05, y(i), "appuyé", fontsize=7, color=GRIS, va="center") etapes = [(1, "① maintenir BOOT"), (2.3, "② appui bref\nsur RESET"), (4, "③ relâcher BOOT")] for t, txt in etapes: ax.axvline(t, color=GRIS, lw=0.8, ls=":") ax.text(t, 3.05, txt, ha="center", va="bottom", fontsize=8, color=ENCRE) ax.text(5.0, -0.75, "→ la carte démarre en mode téléchargement", ha="center", fontsize=8.5, color=VERT, fontweight="bold") ax.set_ylim(-1.1, 4.1) fig.tight_layout() return fig FIGURES = [ Figure("m00-chaine-developpement", chaine_developpement), Figure("m00-boot-reset", boot_reset), ]