Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:78fa04b4dbd6, committed 2022-05-31
- Comitter:
- Giamarchi
- Date:
- Tue May 31 04:13:34 2022 +0000
- Parent:
- 2:b869fd151c26
- Commit message:
- MAJ
Changed in this revision
--- a/main.cpp Wed Jun 23 09:46:55 2021 +0000
+++ b/main.cpp Tue May 31 04:13:34 2022 +0000
@@ -16,11 +16,13 @@
uint8_t etat, etat_mem;
float mes_accu;
+uint16_t tick_UART;
int main() {
Init_System();
etat = 0;
+ tick_UART = 500;
while (1) {
thread_sleep_for(1); // Boucle toutes les 1 milliseconde environ
@@ -33,33 +35,52 @@
// Initialisation du µC
case 0:
-
+// ctrl_reg = 1;
+ thread_sleep_for(1000);
+ etat = 3;
+ etat = 1;
break;
/******************************************************************************/
// Mode Gestion : Gestion des actions
// Contrôle du système
case 1:
-
+ mes_accu = batin.read()*4.587f + 0.31f; // 3.3 * 1.39
+ if(!tick_UART--)
+ {
+ tick_UART = 500;
+ pc.printf ("Bat: %.2fV\r\n",mes_accu);
+ }
+ if(mes_accu < BAT_SEUIL_BAS_1)
+ etat = 4;
+ else
+ etat = 2;
break;
/******************************************************************************/
// Mode Mission : Acquisition de données (Mesure Courant faces solaires)
// Stockage
case 2:
-
+ thread_sleep_for(1000);
+ etat = 3;
break;
/******************************************************************************/
// Mode Radio : Transmission de données
case 3:
-
+ thread_sleep_for(1000);
+ etat = 1;
break;
/******************************************************************************/
// Mode Survie : Attente recharge de l'accu
case 4:
+ mes_accu = batin.read()*4.587f + 0.31f; // 3.3 * 1.39
+ if(mes_accu < BAT_SEUIL_BAS_2)
+ etat = 5;
+ if(mes_accu > BAT_SEUIL_HAUT_1)
+ etat = 1;
break;
/******************************************************************************/
// Mode Zombie : Coupure des consommateurs
@@ -68,7 +89,11 @@
// passage en mode Sleep
case 5:
+// ctrl_reg = 0;
+ mes_accu = batin.read()*4.587f + 0.31f; // 3.3 * 1.39
+ if(mes_accu > BAT_SEUIL_HAUT_1)
+ etat = 0;
break;
/******************************************************************************/
default:
--- a/system.h Wed Jun 23 09:46:55 2021 +0000 +++ b/system.h Tue May 31 04:13:34 2022 +0000 @@ -21,6 +21,6 @@ // Divers seuils pour la batterie #define BAT_SEUIL_HAUT_2 4.2f #define BAT_SEUIL_HAUT_1 3.9f -#define BAT_SEUIL_BAS_1 3.7f -#define BAT_SEUIL_BAS_2 3.5f +#define BAT_SEUIL_BAS_1 3.5f +#define BAT_SEUIL_BAS_2 3.3f
--- a/user.h Wed Jun 23 09:46:55 2021 +0000
+++ b/user.h Tue May 31 04:13:34 2022 +0000
@@ -35,15 +35,13 @@
/******************************************************************************/
// Fonction pour initialiser les fonctions précédentes
-
void Init_User_Fonctions(void) {
- ctrl_reg = 1; // Pour mettre sous tension le moniteur de courant des Solar Panels
+// Pour mettre sous tension le moniteur de courant des faces solaires
+ ctrl_reg = 1;
+}
-}
// Fonction pour stopper les fonctions précédentes
-
void Stop_User_Fonctions(void) {
ctrl_reg = 0;
-
}
/******************************************************************************/
\ No newline at end of file