char input

Dependencies:   TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG lvgl_RB FastPWM millis

Committer:
becanromain
Date:
Fri Feb 28 00:05:30 2020 +0000
Revision:
6:21e96e439978
Parent:
5:cab3e2179cbf

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
becanromain 0:cf6b1eca3e67 1 #include "mbed.h"
becanromain 0:cf6b1eca3e67 2 #include "TS_DISCO_F746NG.h"
becanromain 0:cf6b1eca3e67 3 #include "LCD_DISCO_F746NG.h"
becanromain 0:cf6b1eca3e67 4 #include "lvgl/lvgl.h"
becanromain 0:cf6b1eca3e67 5 #include "lv_conf.h"
becanromain 0:cf6b1eca3e67 6 #include "millis.h"
becanromain 0:cf6b1eca3e67 7 #include "FastPWM.h"
becanromain 0:cf6b1eca3e67 8 #include <string>
becanromain 6:21e96e439978 9 //#include <stdio.h>
becanromain 4:6a3d12663549 10 #include "lv_i18n.h"
becanromain 4:6a3d12663549 11
becanromain 4:6a3d12663549 12 #include "lv_theme_rb.h" //GABOR
becanromain 0:cf6b1eca3e67 13
becanromain 0:cf6b1eca3e67 14 Ticker ticker; //Initialize system tick
becanromain 0:cf6b1eca3e67 15 LCD_DISCO_F746NG lcd; //Initialize display driver
becanromain 0:cf6b1eca3e67 16 TS_DISCO_F746NG ts; //Initialize touchpad driver
becanromain 0:cf6b1eca3e67 17 TS_StateTypeDef TS_State; //Initialize touch state sctruct
becanromain 0:cf6b1eca3e67 18
becanromain 0:cf6b1eca3e67 19 Serial serial(USBTX, USBRX);
becanromain 0:cf6b1eca3e67 20
becanromain 0:cf6b1eca3e67 21 /*********************
becanromain 0:cf6b1eca3e67 22 * ENTREES SORTIES
becanromain 0:cf6b1eca3e67 23 *********************/
becanromain 0:cf6b1eca3e67 24 //TENSION BATTERIE
becanromain 0:cf6b1eca3e67 25 AnalogIn AI_TENSION_BAT(A4);
becanromain 0:cf6b1eca3e67 26
becanromain 0:cf6b1eca3e67 27 //PWM
becanromain 0:cf6b1eca3e67 28 FastPWM fastpwm(D12,1); //steup pwm output on pin d12 with a prescaler of 1
becanromain 4:6a3d12663549 29
becanromain 4:6a3d12663549 30 //MARCHE POMPE
becanromain 4:6a3d12663549 31 DigitalOut DO_POMPE(D13);
becanromain 4:6a3d12663549 32
becanromain 0:cf6b1eca3e67 33 //COMPTEUR IMPULSION
becanromain 0:cf6b1eca3e67 34 DigitalIn DI_CPTPuls(D7);
becanromain 0:cf6b1eca3e67 35 //InterruptIn DI_CPTPuls(D7); //
becanromain 4:6a3d12663549 36
becanromain 4:6a3d12663549 37
becanromain 0:cf6b1eca3e67 38
becanromain 0:cf6b1eca3e67 39 /**********************
becanromain 0:cf6b1eca3e67 40 * VARIABLES GENERALES
becanromain 0:cf6b1eca3e67 41 **********************/
becanromain 0:cf6b1eca3e67 42 int X;
becanromain 0:cf6b1eca3e67 43 int Y;
becanromain 0:cf6b1eca3e67 44 Timer tempo;
becanromain 0:cf6b1eca3e67 45 bool Top1ms;
becanromain 0:cf6b1eca3e67 46 bool Top10ms;
becanromain 0:cf6b1eca3e67 47 bool Top100ms;
becanromain 0:cf6b1eca3e67 48 bool Top1s;
becanromain 0:cf6b1eca3e67 49 bool Top5s;
becanromain 0:cf6b1eca3e67 50 bool Top1min;
becanromain 0:cf6b1eca3e67 51 char text[100];
becanromain 0:cf6b1eca3e67 52 char text2[100];
becanromain 0:cf6b1eca3e67 53
becanromain 0:cf6b1eca3e67 54 int CsgPompe=0;
becanromain 0:cf6b1eca3e67 55
becanromain 0:cf6b1eca3e67 56 uint64_t Micros=0;
becanromain 0:cf6b1eca3e67 57
becanromain 0:cf6b1eca3e67 58 uint64_t MemMicros0=0;
becanromain 0:cf6b1eca3e67 59 uint64_t MemMicros1=0;
becanromain 0:cf6b1eca3e67 60 uint64_t MemMicros2=0;
becanromain 0:cf6b1eca3e67 61 uint64_t MemMicros3=0;
becanromain 0:cf6b1eca3e67 62 uint64_t MemMicros4=0;
becanromain 0:cf6b1eca3e67 63 uint64_t MemMicros5=0;
becanromain 0:cf6b1eca3e67 64
becanromain 0:cf6b1eca3e67 65
becanromain 6:21e96e439978 66
becanromain 0:cf6b1eca3e67 67 int CalcFmPuls;
becanromain 0:cf6b1eca3e67 68 int CalcFdPuls;
becanromain 0:cf6b1eca3e67 69 bool FmCPTPuls;
becanromain 0:cf6b1eca3e67 70 uint64_t TimerPuls=0;
becanromain 0:cf6b1eca3e67 71 uint64_t TpsPuls=0;
becanromain 0:cf6b1eca3e67 72 float Calcul=0;
becanromain 0:cf6b1eca3e67 73 uint64_t MemTpsPuls=0;
becanromain 0:cf6b1eca3e67 74 uint64_t MemTps16Puls=0;
becanromain 0:cf6b1eca3e67 75 int NumDent=0;
becanromain 0:cf6b1eca3e67 76 uint64_t CptPuls=0;
becanromain 0:cf6b1eca3e67 77 uint64_t CalcDebit=0;
becanromain 0:cf6b1eca3e67 78 float TpsEntre2Puls[20];
becanromain 0:cf6b1eca3e67 79 float TpsMinEntre2Puls;
becanromain 0:cf6b1eca3e67 80 float TpsMaxEntre2Puls;
becanromain 0:cf6b1eca3e67 81 float VolParTour=1200;//en ml
becanromain 0:cf6b1eca3e67 82
becanromain 0:cf6b1eca3e67 83 int hres = 480;
becanromain 0:cf6b1eca3e67 84 int vres = 272;
becanromain 4:6a3d12663549 85 bool CDA_POMPE;
becanromain 0:cf6b1eca3e67 86
becanromain 6:21e96e439978 87 uint64_t TpsMaPpe=0;
becanromain 6:21e96e439978 88
becanromain 0:cf6b1eca3e67 89
becanromain 0:cf6b1eca3e67 90 uint64_t test=0;
becanromain 0:cf6b1eca3e67 91
becanromain 0:cf6b1eca3e67 92 //VARIABLES GESTION MOT DE PASSE
becanromain 0:cf6b1eca3e67 93
becanromain 0:cf6b1eca3e67 94
becanromain 0:cf6b1eca3e67 95 /*********************
becanromain 6:21e96e439978 96 * FONCTIONS GENERALES
becanromain 6:21e96e439978 97 *********************/
becanromain 6:21e96e439978 98 static char *S(string S);
becanromain 6:21e96e439978 99 char *Chemin;
becanromain 6:21e96e439978 100 static char *HHMMSS(int32_t seconde);
becanromain 6:21e96e439978 101
becanromain 6:21e96e439978 102 /*********************
becanromain 0:cf6b1eca3e67 103 * OBJET PAGES
becanromain 0:cf6b1eca3e67 104 *********************/
becanromain 0:cf6b1eca3e67 105 static lv_obj_t * BandeauHaut;
becanromain 0:cf6b1eca3e67 106 static void AFFBandeauHaut(int Num);
becanromain 0:cf6b1eca3e67 107 static lv_obj_t * SousMenu;
becanromain 0:cf6b1eca3e67 108 static void AFFSousMenu(int Num);
becanromain 0:cf6b1eca3e67 109 static lv_obj_t * Page;
becanromain 4:6a3d12663549 110 int PageAff=0;
becanromain 4:6a3d12663549 111 int MemPageAff=0;
becanromain 0:cf6b1eca3e67 112 static void AFFPage(int Num);
becanromain 0:cf6b1eca3e67 113
becanromain 4:6a3d12663549 114
becanromain 0:cf6b1eca3e67 115 static lv_obj_t * PopupMDP;
becanromain 0:cf6b1eca3e67 116 static void AFFPopupMDP();
becanromain 0:cf6b1eca3e67 117
becanromain 0:cf6b1eca3e67 118 static void init_all_themes(uint16_t hue);
becanromain 0:cf6b1eca3e67 119
becanromain 0:cf6b1eca3e67 120 /*********************
becanromain 0:cf6b1eca3e67 121 * OBJET GENERAUX
becanromain 0:cf6b1eca3e67 122 *********************/
becanromain 0:cf6b1eca3e67 123 static lv_obj_t *mbox;
becanromain 0:cf6b1eca3e67 124
becanromain 0:cf6b1eca3e67 125 /*****************************
becanromain 0:cf6b1eca3e67 126 * VARIABLES/OBJETS CONNEXION
becanromain 0:cf6b1eca3e67 127 *****************************/
becanromain 0:cf6b1eca3e67 128 static lv_obj_t * SelectID;
becanromain 0:cf6b1eca3e67 129 static lv_obj_t * MDP;
becanromain 0:cf6b1eca3e67 130 static void SelectID_ACT(lv_obj_t * obj, lv_event_t event);
becanromain 0:cf6b1eca3e67 131 uint32_t TpsMdpEnCours=0;
becanromain 0:cf6b1eca3e67 132 struct Personne
becanromain 0:cf6b1eca3e67 133 {
becanromain 0:cf6b1eca3e67 134 string Nom;
becanromain 0:cf6b1eca3e67 135 string MDP; //mot de passe à 4 chiffres
becanromain 0:cf6b1eca3e67 136 int Niveau; //0:aucun 1:Opérateur 2:superviseur 3:constructeur
becanromain 0:cf6b1eca3e67 137 int Tps; //Temps de connexion
becanromain 0:cf6b1eca3e67 138 };
becanromain 0:cf6b1eca3e67 139 Personne User[100];
becanromain 0:cf6b1eca3e67 140 Personne UserEC;
becanromain 6:21e96e439978 141
becanromain 6:21e96e439978 142 /*********
becanromain 6:21e96e439978 143 * ETALON
becanromain 6:21e96e439978 144 *********/
becanromain 6:21e96e439978 145 struct HistoEtal{
becanromain 6:21e96e439978 146 int Annee;
becanromain 6:21e96e439978 147 int Mois;
becanromain 6:21e96e439978 148 float ProvDeriv1;//Provision de dérive étalon
becanromain 6:21e96e439978 149 bool Ajustage;//Ajustage réalisé
becanromain 6:21e96e439978 150 };
becanromain 6:21e96e439978 151
becanromain 6:21e96e439978 152 struct Etalon
becanromain 6:21e96e439978 153 {
becanromain 6:21e96e439978 154 string Nom;
becanromain 6:21e96e439978 155 float ValPuls; //Valeur impulsion compteur
becanromain 6:21e96e439978 156 float EMT; //Ecart maximum toléré
becanromain 6:21e96e439978 157 HistoEtal Hist[5]; //historique étalon
becanromain 6:21e96e439978 158 };
becanromain 6:21e96e439978 159 Etalon EtalCpt[20];
becanromain 6:21e96e439978 160 Etalon EtaTemp[20];
becanromain 6:21e96e439978 161 Etalon EtalMano[20];
becanromain 6:21e96e439978 162
becanromain 6:21e96e439978 163 Etalon EtalCptEC;
becanromain 6:21e96e439978 164 Etalon EtaTempEC;
becanromain 6:21e96e439978 165 Etalon EtalManoEC;
becanromain 6:21e96e439978 166
becanromain 6:21e96e439978 167 /*****************************/
becanromain 6:21e96e439978 168
becanromain 0:cf6b1eca3e67 169 static void BpValidMDP_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 170 static void BpAnnulMDP_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 171 static void mboxMdp_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 172 static void mboxMdp_ACT2(lv_obj_t * btn, lv_event_t event);
becanromain 6:21e96e439978 173 static void kb_MDP_ACT(lv_obj_t * event_kb, lv_event_t event);
becanromain 6:21e96e439978 174 static void mbox_ACT(lv_obj_t * obj, lv_event_t event);
becanromain 0:cf6b1eca3e67 175
becanromain 0:cf6b1eca3e67 176 /*********************
becanromain 0:cf6b1eca3e67 177 * OBJETS BP MENU
becanromain 0:cf6b1eca3e67 178 *********************/
becanromain 6:21e96e439978 179
becanromain 6:21e96e439978 180 static lv_obj_t * BPMENU;
becanromain 0:cf6b1eca3e67 181 static lv_obj_t * M100;
becanromain 0:cf6b1eca3e67 182 static lv_obj_t * M200;
becanromain 0:cf6b1eca3e67 183 static lv_obj_t * M300;
becanromain 0:cf6b1eca3e67 184 static lv_obj_t * M400;
becanromain 0:cf6b1eca3e67 185 static lv_obj_t * M500;
becanromain 0:cf6b1eca3e67 186 static lv_obj_t * M600;
becanromain 6:21e96e439978 187 static lv_obj_t * M700;
becanromain 0:cf6b1eca3e67 188
becanromain 0:cf6b1eca3e67 189 //FONCTIONS ASSOCIEES
becanromain 6:21e96e439978 190
becanromain 6:21e96e439978 191 static void BPMENU_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 192 static void M100_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 193 static void M200_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 194 static void M300_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 195 static void M400_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 196 static void M500_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 197 static void M600_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 6:21e96e439978 198 static void M700_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 199
becanromain 6:21e96e439978 200 static void SM_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 201
becanromain 6:21e96e439978 202 int TpsAvFermMenu=5000;
becanromain 6:21e96e439978 203 int TpsAvFermSousMenu=5000;
becanromain 6:21e96e439978 204 int NumBandeauHaut;
becanromain 6:21e96e439978 205 int NumSousMenu;
becanromain 6:21e96e439978 206 bool DdeFermBandeauHaut;
becanromain 0:cf6b1eca3e67 207
becanromain 0:cf6b1eca3e67 208 /*********************
becanromain 0:cf6b1eca3e67 209 * OBJETS
becanromain 0:cf6b1eca3e67 210 *********************/
becanromain 0:cf6b1eca3e67 211 static lv_obj_t *FondGris ;
becanromain 0:cf6b1eca3e67 212 static lv_obj_t *FondGris2 ;
becanromain 0:cf6b1eca3e67 213
becanromain 0:cf6b1eca3e67 214 /*********************
becanromain 0:cf6b1eca3e67 215 * MATRICE DE BOUTONS
becanromain 0:cf6b1eca3e67 216 *********************/
becanromain 6:21e96e439978 217 static const char * PAVE_MDP_MAP[] = {"7", "8", "9", LV_SYMBOL_CLOSE,"\n",
becanromain 6:21e96e439978 218 "4", "5","6", LV_SYMBOL_OK, "\n",
becanromain 6:21e96e439978 219 "1", "2", "3", LV_SYMBOL_BACKSPACE,"\n",
becanromain 6:21e96e439978 220 "0", ""};
becanromain 6:21e96e439978 221
becanromain 6:21e96e439978 222
becanromain 6:21e96e439978 223 static const char * PAVE_NUMERIQUE_MAP[] = {
becanromain 6:21e96e439978 224 "7", "8", "9","\n",
becanromain 6:21e96e439978 225 "4", "5","6","\n",
becanromain 0:cf6b1eca3e67 226 "1", "2", "3","\n",
becanromain 6:21e96e439978 227 "0",",","+/-","\n",
becanromain 6:21e96e439978 228 LV_SYMBOL_BACKSPACE,LV_SYMBOL_OK, LV_SYMBOL_CLOSE, ""};
becanromain 6:21e96e439978 229
becanromain 6:21e96e439978 230
becanromain 6:21e96e439978 231 // "7", "8", "9","\n",
becanromain 6:21e96e439978 232 // "4", "5","6", "\n",
becanromain 6:21e96e439978 233 // "1", "2", "3","\n",
becanromain 6:21e96e439978 234 // "0", ".","+/-","\n",
becanromain 6:21e96e439978 235 // LV_SYMBOL_BACKSPACE, LV_SYMBOL_OK,LV_SYMBOL_CLOSE};
becanromain 0:cf6b1eca3e67 236 /*********************
becanromain 0:cf6b1eca3e67 237 * STYLES
becanromain 0:cf6b1eca3e67 238 *********************/
becanromain 6:21e96e439978 239 static lv_style_t P10,P12,P16,P18,P22,PG12,PG16,PG18,PG22;
becanromain 6:21e96e439978 240 static lv_style_t P16Saisie;
becanromain 0:cf6b1eca3e67 241 static lv_style_t Style_BP;
becanromain 0:cf6b1eca3e67 242
becanromain 6:21e96e439978 243 static void StyleBPSM(lv_obj_t * Obj);
becanromain 6:21e96e439978 244 static void StyleBPM(lv_obj_t * Obj);
becanromain 6:21e96e439978 245
becanromain 4:6a3d12663549 246 /*********************
becanromain 4:6a3d12663549 247 * MULTILANGUE
becanromain 4:6a3d12663549 248 *********************/
becanromain 4:6a3d12663549 249 static void LANGUE_FR_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 4:6a3d12663549 250 static void LANGUE_EN_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 251
becanromain 6:21e96e439978 252
becanromain 0:cf6b1eca3e67 253 void initialisation();
becanromain 0:cf6b1eca3e67 254 void interruptCompteur();
becanromain 0:cf6b1eca3e67 255
becanromain 0:cf6b1eca3e67 256 static void BPRAZ_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 4:6a3d12663549 257 static void BPPOMPE_ACT(lv_obj_t * btn, lv_event_t event);
becanromain 0:cf6b1eca3e67 258 static lv_theme_t * th_act;
becanromain 0:cf6b1eca3e67 259 static lv_obj_t * label;
becanromain 6:21e96e439978 260 static lv_obj_t * label01;
becanromain 6:21e96e439978 261 static lv_obj_t * label02;
becanromain 6:21e96e439978 262 static lv_obj_t * label03;
becanromain 6:21e96e439978 263 static lv_obj_t * label04;
becanromain 0:cf6b1eca3e67 264
becanromain 0:cf6b1eca3e67 265 static lv_obj_t * AffCptPuls;
becanromain 0:cf6b1eca3e67 266 static lv_obj_t * Aff1TpsEntre2Puls;
becanromain 0:cf6b1eca3e67 267 static lv_obj_t * Aff2TpsEntre2Puls;
becanromain 0:cf6b1eca3e67 268 static lv_obj_t * AffTpsMinEntre2Puls;
becanromain 0:cf6b1eca3e67 269 static lv_obj_t * AffTpsMaxEntre2Puls;
becanromain 0:cf6b1eca3e67 270 static lv_obj_t * BPRAZ;
becanromain 4:6a3d12663549 271 static lv_obj_t * BPPOMPE;
becanromain 0:cf6b1eca3e67 272
becanromain 6:21e96e439978 273
becanromain 6:21e96e439978 274 static lv_obj_t * AffChemin;
becanromain 6:21e96e439978 275 static lv_obj_t * AffSymbBat;
becanromain 6:21e96e439978 276 static lv_obj_t * AffPourcBat;
becanromain 6:21e96e439978 277
becanromain 6:21e96e439978 278 /************************
becanromain 6:21e96e439978 279 * TYPE DONNEES A SAISIR
becanromain 6:21e96e439978 280 ************************/
becanromain 6:21e96e439978 281 static lv_obj_t * kb;
becanromain 6:21e96e439978 282 lv_obj_t *ChSaisi;
becanromain 6:21e96e439978 283
becanromain 6:21e96e439978 284 typedef struct Float_S
becanromain 6:21e96e439978 285 {
becanromain 6:21e96e439978 286 float Val;
becanromain 6:21e96e439978 287 const char * Unit;
becanromain 6:21e96e439978 288 lv_obj_t * Aff;
becanromain 6:21e96e439978 289 float Min;
becanromain 6:21e96e439978 290 float Max;
becanromain 6:21e96e439978 291 int Niveau; //0:aucun 1:Opérateur 2:superviseur 3:constructeur
becanromain 6:21e96e439978 292 const char * Txt;
becanromain 6:21e96e439978 293 };
becanromain 6:21e96e439978 294 static Float_S *SaisieFloat;
becanromain 6:21e96e439978 295 static void DdeSaisieFloat(lv_obj_t * label, lv_event_t event);
becanromain 6:21e96e439978 296 static void PageSaisieFloat(lv_obj_t * label);
becanromain 6:21e96e439978 297 static void KbSaisieFloat_ACT(lv_obj_t * event_kb, lv_event_t event);
becanromain 6:21e96e439978 298
becanromain 6:21e96e439978 299 typedef struct Int_S
becanromain 6:21e96e439978 300 {
becanromain 6:21e96e439978 301 int Val;
becanromain 6:21e96e439978 302 const char * Unit;
becanromain 6:21e96e439978 303 lv_obj_t * Aff;
becanromain 6:21e96e439978 304 int Min;
becanromain 6:21e96e439978 305 int Max;
becanromain 6:21e96e439978 306 int Niveau; //0:aucun 1:Opérateur 2:superviseur 3:constructeur
becanromain 6:21e96e439978 307 const char * Txt;
becanromain 6:21e96e439978 308 };
becanromain 6:21e96e439978 309 static Int_S *SaisieInt;
becanromain 6:21e96e439978 310 static void DdeSaisieInt(lv_obj_t * label, lv_event_t event);
becanromain 6:21e96e439978 311 static void PageSaisieInt(lv_obj_t * label);
becanromain 6:21e96e439978 312 static void KbSaisieInt_ACT(lv_obj_t * event_kb, lv_event_t event);
becanromain 6:21e96e439978 313
becanromain 0:cf6b1eca3e67 314
becanromain 6:21e96e439978 315 typedef struct Txt_S
becanromain 6:21e96e439978 316 {
becanromain 6:21e96e439978 317 const char * Val; //Gabor
becanromain 6:21e96e439978 318 lv_obj_t * Aff;
becanromain 6:21e96e439978 319 int Niveau; //0:aucun 1:Opérateur 2:superviseur 3:constructeur
becanromain 6:21e96e439978 320 const char * Txt;
becanromain 6:21e96e439978 321 int NbCarMax;
becanromain 6:21e96e439978 322 };
becanromain 6:21e96e439978 323 static Txt_S *SaisieTxt;
becanromain 6:21e96e439978 324 static void DdeSaisieTxt(lv_obj_t * label, lv_event_t event);
becanromain 6:21e96e439978 325 static void PageSaisieTxt(lv_obj_t * label);
becanromain 6:21e96e439978 326 static void KbSaisieTxt_ACT(lv_obj_t * event_kb, lv_event_t event);
becanromain 6:21e96e439978 327
becanromain 6:21e96e439978 328 /**************************
becanromain 6:21e96e439978 329 * TYPE DONNEES A AFFICHER
becanromain 6:21e96e439978 330 **************************/
becanromain 6:21e96e439978 331 typedef struct Float_A
becanromain 6:21e96e439978 332 {
becanromain 6:21e96e439978 333 float Val;
becanromain 6:21e96e439978 334 const char * Unit;
becanromain 6:21e96e439978 335 lv_obj_t * Aff;
becanromain 6:21e96e439978 336 };
becanromain 6:21e96e439978 337 typedef struct Int_A
becanromain 6:21e96e439978 338 {
becanromain 6:21e96e439978 339 long int Val;
becanromain 6:21e96e439978 340 const char * Unit;
becanromain 6:21e96e439978 341 lv_obj_t * Aff;
becanromain 6:21e96e439978 342 };
becanromain 6:21e96e439978 343 typedef struct Txt_A
becanromain 6:21e96e439978 344 {
becanromain 6:21e96e439978 345 const char * Val;
becanromain 6:21e96e439978 346 lv_obj_t * Aff;
becanromain 6:21e96e439978 347 };
becanromain 6:21e96e439978 348
becanromain 6:21e96e439978 349
becanromain 6:21e96e439978 350 /*********************
becanromain 6:21e96e439978 351 * DONNEES A AFFICHER
becanromain 6:21e96e439978 352 *********************/
becanromain 6:21e96e439978 353 Float_S CsgDebit;
becanromain 6:21e96e439978 354 Float_A Volume;
becanromain 6:21e96e439978 355 Float_A Debit;
becanromain 6:21e96e439978 356 Float_A DebitMoy;
becanromain 6:21e96e439978 357 Txt_A ProgEC;
becanromain 6:21e96e439978 358 Int_A Duree;
becanromain 6:21e96e439978 359 Int_A TotalisateurVol;
becanromain 6:21e96e439978 360 Int_A TotalisateurDuree;
becanromain 6:21e96e439978 361 Int_S NPremiereMin;
becanromain 6:21e96e439978 362 Int_S NDerniereMin;
becanromain 6:21e96e439978 363 Float_A DebNPremiereMin;
becanromain 6:21e96e439978 364 Float_A DebNDerniereMin;
becanromain 6:21e96e439978 365 Float_A EcartType;
becanromain 6:21e96e439978 366 Float_A TensionBat;
becanromain 6:21e96e439978 367 Float_A Intensite;
becanromain 6:21e96e439978 368 Float_A VitessePpe;
becanromain 6:21e96e439978 369 Float_A ConsoPrelev;
becanromain 6:21e96e439978 370 Float_A Puissance;
becanromain 6:21e96e439978 371 Txt_S NomEquipement;
becanromain 6:21e96e439978 372 Txt_S NumSerieEquipement;
becanromain 6:21e96e439978 373
becanromain 6:21e96e439978 374 float MoyTensBat[101];
becanromain 6:21e96e439978 375 float TpsCy=0;
becanromain 6:21e96e439978 376 uint64_t CalcTpsCy=0;
becanromain 6:21e96e439978 377 static lv_obj_t * AffTpsCy;
becanromain 0:cf6b1eca3e67 378
becanromain 0:cf6b1eca3e67 379 void lv_ticker_func();
becanromain 0:cf6b1eca3e67 380 void my_disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p);
becanromain 0:cf6b1eca3e67 381 bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
becanromain 0:cf6b1eca3e67 382 static void event_handler(lv_obj_t * obj, lv_event_t event);
becanromain 0:cf6b1eca3e67 383
becanromain 0:cf6b1eca3e67 384
becanromain 0:cf6b1eca3e67 385 static void ddlist_event_cb(lv_obj_t * ddlist, lv_event_t event);
becanromain 0:cf6b1eca3e67 386 static lv_obj_t * slider;
becanromain 0:cf6b1eca3e67 387
becanromain 0:cf6b1eca3e67 388 int PosX_MenuDepart = 0;
becanromain 0:cf6b1eca3e67 389 int PosX_MenuCible = 0;
becanromain 0:cf6b1eca3e67 390 bool DdeAlignMenu = 0;
becanromain 0:cf6b1eca3e67 391
becanromain 0:cf6b1eca3e67 392 int PosY_AnimSousMenu = 0;
becanromain 0:cf6b1eca3e67 393 int AnimSousMenu=0;
becanromain 6:21e96e439978 394
becanromain 0:cf6b1eca3e67 395
becanromain 0:cf6b1eca3e67 396 static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event);
becanromain 0:cf6b1eca3e67 397
becanromain 0:cf6b1eca3e67 398 int TestAff = 0;
becanromain 0:cf6b1eca3e67 399
becanromain 0:cf6b1eca3e67 400
becanromain 0:cf6b1eca3e67 401 static lv_obj_t * Val_R;
becanromain 0:cf6b1eca3e67 402
becanromain 0:cf6b1eca3e67 403 static lv_obj_t * R;
becanromain 0:cf6b1eca3e67 404
becanromain 0:cf6b1eca3e67 405
becanromain 0:cf6b1eca3e67 406 int Reglage_R;
becanromain 0:cf6b1eca3e67 407 uint8_t Reglage_G;
becanromain 0:cf6b1eca3e67 408 uint8_t Reglage_B;
becanromain 0:cf6b1eca3e67 409 uint32_t Reglage_RGB;
becanromain 0:cf6b1eca3e67 410
becanromain 0:cf6b1eca3e67 411 uint8_t R1=255,G1=255,B1=255,
becanromain 0:cf6b1eca3e67 412 R2=0 ,G2=0 ,B2=0,
becanromain 6:21e96e439978 413 R3=114 ,G3=179 ,B3=244,
becanromain 6:21e96e439978 414 R4=255,G4=255,B4=240,
becanromain 6:21e96e439978 415 R5=0,G5=145,B5=145,
becanromain 6:21e96e439978 416 R6=0,G6=0,B6=0,
becanromain 6:21e96e439978 417 R7=255,G7=255,B7=240,
becanromain 6:21e96e439978 418 R8=114 ,G8=179 ,B8=244,
becanromain 6:21e96e439978 419 R9=0,G9=145,B9=145,
becanromain 0:cf6b1eca3e67 420 R10=155,G10=238,B10=131,
becanromain 0:cf6b1eca3e67 421 R11=145,G11=145,B11=145,
becanromain 0:cf6b1eca3e67 422 R12=51,G12=37,B12=22,
becanromain 0:cf6b1eca3e67 423 R13=255,G13=255,B13=255,
becanromain 6:21e96e439978 424 R14=153,G14=158,B14=117;
becanromain 6:21e96e439978 425
becanromain 0:cf6b1eca3e67 426 int NumCouleur=0;
becanromain 0:cf6b1eca3e67 427
becanromain 0:cf6b1eca3e67 428
becanromain 0:cf6b1eca3e67 429 static lv_theme_t * themes[8];
becanromain 0:cf6b1eca3e67 430
becanromain 0:cf6b1eca3e67 431
becanromain 0:cf6b1eca3e67 432 int main()
becanromain 0:cf6b1eca3e67 433 {
becanromain 0:cf6b1eca3e67 434 //demarrage communication avec PC
becanromain 0:cf6b1eca3e67 435 serial.baud(9600);
becanromain 0:cf6b1eca3e67 436 serial.printf("DEBUT DE PROGRAMME\r\n");
becanromain 0:cf6b1eca3e67 437 //Entree impulsion
becanromain 0:cf6b1eca3e67 438 DI_CPTPuls.mode(PullUp);
becanromain 0:cf6b1eca3e67 439
becanromain 0:cf6b1eca3e67 440 //lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"LittlevGL DEMO", CENTER_MODE);
becanromain 0:cf6b1eca3e67 441 ticker.attach(&lv_ticker_func,0.005);// Appel de la fonction LittlVGL toutes les 5ms
becanromain 0:cf6b1eca3e67 442 wait(0.5);
becanromain 0:cf6b1eca3e67 443 lv_init(); //Initialize the LittlevGL
becanromain 0:cf6b1eca3e67 444
becanromain 0:cf6b1eca3e67 445 static lv_disp_buf_t disp_buf;
becanromain 0:cf6b1eca3e67 446 static lv_color_t buf[LV_HOR_RES_MAX * 10]; //Declare a buffer for 10 lines
becanromain 0:cf6b1eca3e67 447 lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); //Initialize the display buffer
becanromain 0:cf6b1eca3e67 448
becanromain 0:cf6b1eca3e67 449 //Implement and register a function which can copy a pixel array to an area of your display
becanromain 0:cf6b1eca3e67 450 lv_disp_drv_t disp_drv; //Descriptor of a display driver
becanromain 0:cf6b1eca3e67 451 lv_disp_drv_init(&disp_drv); //Basic initialization
becanromain 0:cf6b1eca3e67 452 disp_drv.flush_cb = my_disp_flush; //Set your driver function
becanromain 0:cf6b1eca3e67 453 disp_drv.buffer = &disp_buf; //Assign the buffer to the display
becanromain 0:cf6b1eca3e67 454 lv_disp_drv_register(&disp_drv); //Finally register the driver
becanromain 0:cf6b1eca3e67 455
becanromain 0:cf6b1eca3e67 456 //Implement and register a function which can read an input device. E.g. for a touch pad
becanromain 0:cf6b1eca3e67 457 ts.Init(lcd.GetXSize(), lcd.GetYSize()); //ST touch initialization
becanromain 0:cf6b1eca3e67 458 lv_indev_drv_t indev_drv; //Descriptor of a input device driver
becanromain 0:cf6b1eca3e67 459 lv_indev_drv_init(&indev_drv); //Basic initialization
becanromain 0:cf6b1eca3e67 460 indev_drv.type = LV_INDEV_TYPE_POINTER; //Touch pad is a pointer-like device
becanromain 0:cf6b1eca3e67 461 indev_drv.read_cb = my_touchpad_read; //Set your driver function
becanromain 0:cf6b1eca3e67 462 lv_indev_drv_register(&indev_drv); //Finally register the driver
becanromain 0:cf6b1eca3e67 463
becanromain 4:6a3d12663549 464 //INITIALISATION MULTILANGUE
becanromain 4:6a3d12663549 465 lv_i18n_init(lv_i18n_language_pack);
becanromain 4:6a3d12663549 466 lv_i18n_set_locale("fr");
becanromain 0:cf6b1eca3e67 467
becanromain 0:cf6b1eca3e67 468 initialisation();
becanromain 6:21e96e439978 469 AFFBandeauHaut(2);
becanromain 6:21e96e439978 470 AFFPage(102);
becanromain 0:cf6b1eca3e67 471
becanromain 0:cf6b1eca3e67 472 //demarrage tempo générale
becanromain 0:cf6b1eca3e67 473 tempo.start();
becanromain 0:cf6b1eca3e67 474 //Interruption compteur
becanromain 0:cf6b1eca3e67 475 // DI_CPTPuls.rise(&interruptCompteur);
becanromain 0:cf6b1eca3e67 476
becanromain 0:cf6b1eca3e67 477 while(1) {
becanromain 6:21e96e439978 478
becanromain 0:cf6b1eca3e67 479 //TEMPO GENERALE
becanromain 0:cf6b1eca3e67 480 Micros=tempo.read_high_resolution_us();
becanromain 0:cf6b1eca3e67 481 //TOP base de temps
becanromain 0:cf6b1eca3e67 482 Top1ms=false; if (Micros>=MemMicros0+1000) { Top1ms=true; MemMicros0=MemMicros0+1000; }
becanromain 0:cf6b1eca3e67 483 Top10ms=false; if (Micros>=MemMicros1+10000) { Top10ms=true; MemMicros1=MemMicros1+10000; }
becanromain 0:cf6b1eca3e67 484 Top100ms=false; if (Micros>=MemMicros2+100000) { Top100ms=true; MemMicros2=MemMicros2+100000; }
becanromain 0:cf6b1eca3e67 485 Top1s=false; if (Micros>=MemMicros3+1000000) { Top1s=true; MemMicros3=MemMicros3+1000000; }
becanromain 0:cf6b1eca3e67 486 Top5s=false; if (Micros>=MemMicros4+5000000) { Top5s=true; MemMicros4=MemMicros4+5000000; }
becanromain 0:cf6b1eca3e67 487 Top1min=false; if (Micros>=MemMicros5+60000000) { Top1min=true; MemMicros5=MemMicros5+60000000; }
becanromain 6:21e96e439978 488
becanromain 6:21e96e439978 489
becanromain 6:21e96e439978 490 //temps fonctionnement pompe
becanromain 6:21e96e439978 491 if (Top1s){
becanromain 6:21e96e439978 492 if (DO_POMPE) {TpsMaPpe++;}
becanromain 6:21e96e439978 493 }
becanromain 6:21e96e439978 494 //ARRET POMPE SI TENSION BATTERIE <2,9V
becanromain 6:21e96e439978 495 if (Top1min){
becanromain 6:21e96e439978 496 if (TensionBat.Val<2.9) {
becanromain 6:21e96e439978 497 DO_POMPE=false;
becanromain 6:21e96e439978 498 //if (R!=NULL){ lv_slider_set_value(R,10000,LV_ANIM_ON);}
becanromain 6:21e96e439978 499 Reglage_R=10000;
becanromain 6:21e96e439978 500 }
becanromain 6:21e96e439978 501 serial.printf("Temps fonctionnment pompe= %ds Tension= %3.3fV \r\n",TpsMaPpe,TensionBat); //ENREGISTREMENT DONNEES
becanromain 6:21e96e439978 502 }
becanromain 6:21e96e439978 503
becanromain 0:cf6b1eca3e67 504
becanromain 0:cf6b1eca3e67 505 //CALCUL TEMPS DE CYCLE
becanromain 0:cf6b1eca3e67 506 CalcTpsCy++;
becanromain 0:cf6b1eca3e67 507 if (Top1s){
becanromain 0:cf6b1eca3e67 508 TpsCy=1000000000/CalcTpsCy;
becanromain 0:cf6b1eca3e67 509 TpsCy=TpsCy/1000;
becanromain 6:21e96e439978 510 CalcTpsCy=0;
becanromain 6:21e96e439978 511 Duree.Val++;
becanromain 0:cf6b1eca3e67 512 }
becanromain 0:cf6b1eca3e67 513 //Raffraichissement affichage toutes les 10ms
becanromain 0:cf6b1eca3e67 514 if (Top10ms){
becanromain 0:cf6b1eca3e67 515 lv_task_handler();
becanromain 0:cf6b1eca3e67 516 }
becanromain 4:6a3d12663549 517
becanromain 0:cf6b1eca3e67 518 //MISE A JOUR DES VARIABLES AFFICHEES
becanromain 4:6a3d12663549 519 if (Top1s or MemPageAff!=PageAff){
becanromain 4:6a3d12663549 520 MemPageAff=PageAff;
becanromain 6:21e96e439978 521 //bandeau haut
becanromain 6:21e96e439978 522 if (NumBandeauHaut==1){
becanromain 6:21e96e439978 523 sprintf(text, Chemin);
becanromain 6:21e96e439978 524 lv_label_set_text(AffChemin, text);
becanromain 6:21e96e439978 525 }
becanromain 6:21e96e439978 526 //Raffraichissement données affichées
becanromain 6:21e96e439978 527 AFFPage(0);
becanromain 0:cf6b1eca3e67 528 }
becanromain 0:cf6b1eca3e67 529
becanromain 0:cf6b1eca3e67 530 //DETECTION IMPULSION
becanromain 0:cf6b1eca3e67 531 if (DI_CPTPuls and Top1ms){ CalcFdPuls=0;CalcFmPuls++;}
becanromain 0:cf6b1eca3e67 532 if (not DI_CPTPuls and Top1ms){ CalcFmPuls=0;CalcFdPuls++;}
becanromain 0:cf6b1eca3e67 533 if (CalcFmPuls>20 and not FmCPTPuls){interruptCompteur();FmCPTPuls=true;}
becanromain 0:cf6b1eca3e67 534 if (CalcFdPuls>20 and FmCPTPuls){FmCPTPuls=false;}
becanromain 0:cf6b1eca3e67 535 if (CalcFmPuls>500){CalcFmPuls=500;}
becanromain 0:cf6b1eca3e67 536 if (CalcFdPuls>500){CalcFdPuls=500;}
becanromain 0:cf6b1eca3e67 537
becanromain 0:cf6b1eca3e67 538 //MESURE TENSION BATTERIE
becanromain 0:cf6b1eca3e67 539 if (Top10ms){
becanromain 4:6a3d12663549 540 MoyTensBat[0]=AI_TENSION_BAT.read()*3.3*2+0.018;
becanromain 6:21e96e439978 541 TensionBat.Val=0;
becanromain 0:cf6b1eca3e67 542 for (int i=100;i>0;i--){
becanromain 0:cf6b1eca3e67 543 MoyTensBat[i]=MoyTensBat[i-1];
becanromain 6:21e96e439978 544 TensionBat.Val=TensionBat.Val+MoyTensBat[i];
becanromain 0:cf6b1eca3e67 545 }
becanromain 6:21e96e439978 546 TensionBat.Val=TensionBat.Val/100;
becanromain 0:cf6b1eca3e67 547 }
becanromain 0:cf6b1eca3e67 548
becanromain 0:cf6b1eca3e67 549 //COMMANDE POMPE PWM
becanromain 0:cf6b1eca3e67 550 if (Top100ms){
becanromain 0:cf6b1eca3e67 551 CsgPompe=Reglage_R;
becanromain 0:cf6b1eca3e67 552 fastpwm.period_ticks (10000); //setup the period for 100Khz
becanromain 0:cf6b1eca3e67 553 fastpwm.pulsewidth_ticks(CsgPompe);//setup duty cycle to 50%
becanromain 0:cf6b1eca3e67 554 }
becanromain 4:6a3d12663549 555
becanromain 0:cf6b1eca3e67 556 //RAZ MOT DE PASSE
becanromain 0:cf6b1eca3e67 557 if (TpsMdpEnCours>0 and Top1s){
becanromain 0:cf6b1eca3e67 558 TpsMdpEnCours--;
becanromain 0:cf6b1eca3e67 559 if (TpsMdpEnCours==0){
becanromain 0:cf6b1eca3e67 560 mbox=lv_mbox_create(lv_disp_get_scr_act(NULL), NULL);
becanromain 0:cf6b1eca3e67 561 sprintf(text, "Fin de connexion pour %s",UserEC.Nom );
becanromain 0:cf6b1eca3e67 562 lv_mbox_set_text(mbox, text);
becanromain 0:cf6b1eca3e67 563 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 0:cf6b1eca3e67 564 lv_mbox_start_auto_close(mbox, 3000);
becanromain 0:cf6b1eca3e67 565 UserEC.Nom="";
becanromain 0:cf6b1eca3e67 566 UserEC.Niveau=0;
becanromain 0:cf6b1eca3e67 567 }
becanromain 0:cf6b1eca3e67 568 }
becanromain 0:cf6b1eca3e67 569
becanromain 6:21e96e439978 570 //GESTION BANDEAU HAUT
becanromain 6:21e96e439978 571 if (Top1ms and TpsAvFermMenu>0){TpsAvFermMenu--;}
becanromain 6:21e96e439978 572 if (Top1ms and SousMenu){TpsAvFermMenu=4000;}//maintien bandeau affiché si sous menu déployé
becanromain 6:21e96e439978 573 if (TpsAvFermMenu>0 and X>0){TpsAvFermMenu=4000;} //mainitien bandeau affiché si appui sur écran
becanromain 6:21e96e439978 574 if (TpsAvFermMenu>0 and PopupMDP){TpsAvFermMenu=4000;} //maintien bandeau affiché si Popup saisie MDP
becanromain 6:21e96e439978 575 if (TpsAvFermMenu==1){
becanromain 6:21e96e439978 576 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 6:21e96e439978 577 PosX_MenuCible = -lv_obj_get_x(M600);
becanromain 6:21e96e439978 578 DdeAlignMenu=1;
becanromain 6:21e96e439978 579 NumSousMenu=0;
becanromain 6:21e96e439978 580 DdeFermBandeauHaut=false;
becanromain 6:21e96e439978 581 }
becanromain 6:21e96e439978 582
becanromain 6:21e96e439978 583 //ANIMATION BANDEAU HAUT
becanromain 0:cf6b1eca3e67 584 if (Top1ms){
becanromain 0:cf6b1eca3e67 585 if (DdeAlignMenu) {
becanromain 0:cf6b1eca3e67 586 if (PosX_MenuDepart>PosX_MenuCible) {
becanromain 0:cf6b1eca3e67 587 PosX_MenuDepart=PosX_MenuDepart-1;
becanromain 0:cf6b1eca3e67 588 lv_obj_set_pos(BandeauHaut, PosX_MenuDepart, 0);
becanromain 0:cf6b1eca3e67 589 }
becanromain 0:cf6b1eca3e67 590 if (PosX_MenuDepart<PosX_MenuCible) {
becanromain 0:cf6b1eca3e67 591 PosX_MenuDepart=PosX_MenuDepart+1;
becanromain 0:cf6b1eca3e67 592 lv_obj_set_pos(BandeauHaut, PosX_MenuDepart, 0);
becanromain 0:cf6b1eca3e67 593 }
becanromain 0:cf6b1eca3e67 594 if (PosX_MenuDepart==PosX_MenuCible) {
becanromain 0:cf6b1eca3e67 595 DdeAlignMenu=0;
becanromain 6:21e96e439978 596 if (NumSousMenu>0){AFFSousMenu(NumSousMenu);}//affichage page sous menu
becanromain 6:21e96e439978 597 if (NumSousMenu==0){AFFBandeauHaut(1);}//Bandeau haut sans menu
becanromain 0:cf6b1eca3e67 598 }
becanromain 0:cf6b1eca3e67 599 }
becanromain 0:cf6b1eca3e67 600 }
becanromain 0:cf6b1eca3e67 601
becanromain 0:cf6b1eca3e67 602 //ANIMATION SOUS MENU
becanromain 6:21e96e439978 603 if (Top1ms){
becanromain 0:cf6b1eca3e67 604 //OUVERTURE SOUS MENU
becanromain 0:cf6b1eca3e67 605 if (AnimSousMenu>0) {
becanromain 0:cf6b1eca3e67 606 PosY_AnimSousMenu=PosY_AnimSousMenu+2;
becanromain 6:21e96e439978 607 lv_obj_set_size(SousMenu, 230, PosY_AnimSousMenu);
becanromain 0:cf6b1eca3e67 608 if (PosY_AnimSousMenu>=AnimSousMenu){AnimSousMenu=0;}
becanromain 6:21e96e439978 609 TpsAvFermSousMenu=5000;
becanromain 0:cf6b1eca3e67 610 }
becanromain 0:cf6b1eca3e67 611 //TEMPS AVANT FERMEURE
kisvegabor 1:404ee28a0b60 612 if (SousMenu and TpsAvFermSousMenu>0){TpsAvFermSousMenu--;}
becanromain 0:cf6b1eca3e67 613 //FERMETURE SOUS MENU
kisvegabor 1:404ee28a0b60 614 if (SousMenu and TpsAvFermSousMenu<=0) {
becanromain 0:cf6b1eca3e67 615 PosY_AnimSousMenu=PosY_AnimSousMenu-2;
becanromain 6:21e96e439978 616 lv_obj_set_size(SousMenu, 230, PosY_AnimSousMenu);
kisvegabor 1:404ee28a0b60 617 if (PosY_AnimSousMenu<=0){
kisvegabor 1:404ee28a0b60 618 lv_obj_del_async(SousMenu);
kisvegabor 1:404ee28a0b60 619 SousMenu=NULL;
becanromain 6:21e96e439978 620 if(DdeFermBandeauHaut){TpsAvFermMenu=10;DdeFermBandeauHaut=false;}
kisvegabor 1:404ee28a0b60 621 }
becanromain 0:cf6b1eca3e67 622 }
becanromain 0:cf6b1eca3e67 623 }
becanromain 6:21e96e439978 624 if (SousMenu and X>0){TpsAvFermSousMenu=5000;}//mainitien sous menu affiché si appui sur écran
becanromain 6:21e96e439978 625 if (SousMenu and PopupMDP){TpsAvFermSousMenu=5000;} //maintien bandeau affiché si Popup saisie MDP
becanromain 0:cf6b1eca3e67 626
becanromain 0:cf6b1eca3e67 627 /**/
becanromain 0:cf6b1eca3e67 628 }//FIN BOUCLE
becanromain 0:cf6b1eca3e67 629 }//FIN MAIN
becanromain 0:cf6b1eca3e67 630
becanromain 0:cf6b1eca3e67 631
becanromain 6:21e96e439978 632
becanromain 6:21e96e439978 633 static void AffFloat(string Txt,Float_A &Var,int PosX, int PosY){
becanromain 6:21e96e439978 634 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 635 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 636 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 637 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 0:cf6b1eca3e67 638
becanromain 6:21e96e439978 639 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 640 lv_obj_set_style(Var.Aff,&P16);
becanromain 6:21e96e439978 641 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 642 lv_label_set_text_fmt(Var.Aff, "%2.2f %s",Var.Val,Var.Unit);
becanromain 0:cf6b1eca3e67 643 }
becanromain 0:cf6b1eca3e67 644
becanromain 6:21e96e439978 645 static void AffInt(string Txt,Int_A &Var,int PosX, int PosY){
becanromain 6:21e96e439978 646 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 647 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 648 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 649 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 6:21e96e439978 650
becanromain 6:21e96e439978 651 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 652 lv_obj_set_style(Var.Aff,&P16);
becanromain 6:21e96e439978 653 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 654 lv_label_set_text_fmt(Var.Aff, "%d %s",Var.Val,Var.Unit);
becanromain 6:21e96e439978 655 }
becanromain 4:6a3d12663549 656
becanromain 6:21e96e439978 657 static void AffTxt(string Txt,Txt_A &Var,int PosX, int PosY){
becanromain 6:21e96e439978 658 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 659 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 660 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 661 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 6:21e96e439978 662
becanromain 6:21e96e439978 663 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 664 lv_obj_set_style(Var.Aff,&P16);
becanromain 6:21e96e439978 665 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 666 lv_obj_set_click(Var.Aff, true);
becanromain 0:cf6b1eca3e67 667 }
becanromain 0:cf6b1eca3e67 668
becanromain 6:21e96e439978 669 static void InFloat(string Txt,Float_S &Var,int PosX, int PosY){
becanromain 6:21e96e439978 670 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 671 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 672 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 673 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 6:21e96e439978 674
becanromain 6:21e96e439978 675 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 676 lv_obj_set_style(Var.Aff,&P16Saisie);
becanromain 6:21e96e439978 677 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 678 lv_label_set_text_fmt(Var.Aff, "%2.2f %s",Var.Val,Var.Unit);
becanromain 4:6a3d12663549 679
becanromain 6:21e96e439978 680 lv_obj_set_click(Var.Aff, true);
becanromain 6:21e96e439978 681 lv_obj_set_user_data(Var.Aff, &Var);
becanromain 6:21e96e439978 682 lv_obj_set_event_cb(Var.Aff, DdeSaisieFloat);
becanromain 0:cf6b1eca3e67 683 }
becanromain 0:cf6b1eca3e67 684
becanromain 6:21e96e439978 685 static void InInt(string Txt,Int_S &Var,int PosX, int PosY){
becanromain 6:21e96e439978 686 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 687 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 688 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 689 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 6:21e96e439978 690
becanromain 6:21e96e439978 691 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 692 lv_obj_set_style(Var.Aff,&P16Saisie);
becanromain 6:21e96e439978 693 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 694 lv_label_set_text_fmt(Var.Aff, "%d %s",Var.Val,Var.Unit);
becanromain 6:21e96e439978 695
becanromain 6:21e96e439978 696 lv_obj_set_click(Var.Aff, true);
becanromain 6:21e96e439978 697 lv_obj_set_user_data(Var.Aff, &Var);
becanromain 6:21e96e439978 698 lv_obj_set_event_cb(Var.Aff, DdeSaisieInt);
becanromain 0:cf6b1eca3e67 699 }
becanromain 0:cf6b1eca3e67 700
becanromain 6:21e96e439978 701 static void InTxt(string Txt,Txt_S &Var,int PosX, int PosY){//Gabor
becanromain 6:21e96e439978 702 label01 = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 703 lv_obj_set_style(label01,&PG16);
becanromain 6:21e96e439978 704 lv_obj_set_pos(label01, PosX, PosY);
becanromain 6:21e96e439978 705 lv_label_set_text_fmt(label01, "%s",Txt);
becanromain 6:21e96e439978 706
becanromain 6:21e96e439978 707 Var.Aff = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 708 lv_obj_set_style(Var.Aff,&P16Saisie);
becanromain 6:21e96e439978 709 lv_obj_align(Var.Aff, label01, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
becanromain 6:21e96e439978 710
becanromain 6:21e96e439978 711 lv_obj_set_click(Var.Aff, true);
becanromain 6:21e96e439978 712 lv_obj_set_user_data(Var.Aff, &Var);
becanromain 6:21e96e439978 713 lv_obj_set_event_cb(Var.Aff, DdeSaisieTxt);
becanromain 6:21e96e439978 714 }
becanromain 0:cf6b1eca3e67 715
becanromain 0:cf6b1eca3e67 716 static void AFFPage(int Num)
becanromain 0:cf6b1eca3e67 717 {
becanromain 6:21e96e439978 718 //VARIABLES COMMUNES
becanromain 6:21e96e439978 719 int i=0;//index pour décalage ligne
becanromain 6:21e96e439978 720
becanromain 6:21e96e439978 721 //CREATION PAGE
becanromain 6:21e96e439978 722 if (Num>0){
becanromain 6:21e96e439978 723 if(Page) {
becanromain 6:21e96e439978 724 lv_obj_del(Page); ;
becanromain 6:21e96e439978 725 Page = NULL;
becanromain 6:21e96e439978 726 }
becanromain 6:21e96e439978 727 PageAff=Num;//MEMORISATION PAGE AFFICHEE
becanromain 6:21e96e439978 728 Page = lv_page_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 729 lv_obj_set_size(Page, hres, vres-40);
becanromain 6:21e96e439978 730 lv_obj_set_pos(Page, 0, 40);
becanromain 6:21e96e439978 731 lv_page_set_scrl_layout(Page, LV_LAYOUT_OFF);
becanromain 6:21e96e439978 732 lv_page_set_scrl_fit2(Page, LV_FIT_FLOOD, LV_FIT_TIGHT);
becanromain 6:21e96e439978 733 lv_coord_t max_w = lv_page_get_fit_width(Page);
becanromain 6:21e96e439978 734 }
becanromain 6:21e96e439978 735
becanromain 6:21e96e439978 736 ////////////////////////////////////////
becanromain 6:21e96e439978 737 //CREATION PAGE 101: Etat d'avancement//
becanromain 6:21e96e439978 738 ////////////////////////////////////////
becanromain 6:21e96e439978 739 if (Num==101){
becanromain 6:21e96e439978 740 sprintf(Chemin, "%s \\ %s",_("M100"),_("M101"));
becanromain 6:21e96e439978 741 AffTxt(_("Etat de la mallette :"),ProgEC,5, i=i);
becanromain 6:21e96e439978 742 InFloat(_("Consigne débit :"),CsgDebit,5, i=i+20);
becanromain 6:21e96e439978 743 AffFloat(_("Débit intantanné :"),Debit,5, i=i+20);
becanromain 6:21e96e439978 744 AffFloat(_("Débit Moyen prélèvement :"),DebitMoy,5, i=i+20);
becanromain 6:21e96e439978 745 AffFloat(_("Volume prélevé :"),Volume,5, i=i+20);
becanromain 6:21e96e439978 746 AffInt(_("Durée prélèvement :"),Duree,5, i=i+20);
becanromain 6:21e96e439978 747 sprintf(text, _("Débit moyen des %d premières minutes :"),NPremiereMin.Val);
becanromain 6:21e96e439978 748 AffFloat(text,DebNPremiereMin,5, i=i+20);
becanromain 6:21e96e439978 749 sprintf(text, _("Débit moyen des %d dernières minutes :"),NDerniereMin.Val);
becanromain 6:21e96e439978 750 AffFloat(text,DebNDerniereMin,5, i=i+20);
becanromain 6:21e96e439978 751 AffFloat(_("Ecart type:"),EcartType,5, i=i+20);
becanromain 6:21e96e439978 752 AffInt(_("Totalisateur volume:"),TotalisateurVol,5, i=i+20);
becanromain 6:21e96e439978 753 AffInt(_("Totalisateur durée:"),TotalisateurDuree,5, i=i+20);
becanromain 6:21e96e439978 754 AffFloat(_("Tension :"),TensionBat,5, i=i+20);
becanromain 6:21e96e439978 755 AffFloat(_("Intensité :"),Intensite,5, i=i+20);
becanromain 6:21e96e439978 756 AffFloat(_("Vitesse pompe :"),VitessePpe,5, i=i+20);
becanromain 6:21e96e439978 757 AffFloat(_("Consommation prélèvement :"),ConsoPrelev,5, i=i+20);
becanromain 6:21e96e439978 758 AffFloat(_("Puissance :"),Puissance,5, i=i+20);
becanromain 6:21e96e439978 759 PageAff=101;
becanromain 6:21e96e439978 760 }
becanromain 4:6a3d12663549 761
becanromain 6:21e96e439978 762 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 763 if (PageAff==101 and Num==0){
becanromain 6:21e96e439978 764 //PROGRAMME EN COURS
becanromain 6:21e96e439978 765 lv_label_set_text_fmt(ProgEC.Aff, "%s",ProgEC.Val);
becanromain 6:21e96e439978 766 //CONSIGNE DEBIT
becanromain 6:21e96e439978 767 lv_label_set_text_fmt(CsgDebit.Aff, "%2.2f %s",CsgDebit.Val,CsgDebit.Unit);
becanromain 6:21e96e439978 768 //DEBIT INSTANTANNE
becanromain 6:21e96e439978 769 lv_label_set_text_fmt(Debit.Aff, "%2.2f %s",Debit.Val,Debit.Unit);
becanromain 6:21e96e439978 770 //DEBIT MOYEN
becanromain 6:21e96e439978 771 lv_label_set_text_fmt(DebitMoy.Aff, "%2.2f %s",DebitMoy.Val,DebitMoy.Unit);
becanromain 6:21e96e439978 772 //VOLUME PRELEVE
becanromain 6:21e96e439978 773 lv_label_set_text_fmt(Volume.Aff, "%2.1f %s",Volume.Val,Volume.Unit);
becanromain 6:21e96e439978 774 //DUREE PRELEVEMENT
becanromain 6:21e96e439978 775 lv_label_set_text_fmt(Duree.Aff, "%s",HHMMSS(Duree.Val));
becanromain 6:21e96e439978 776 //DEBIT MOYEN DES N PREMIERES MINUTES
becanromain 6:21e96e439978 777 lv_label_set_text_fmt(DebNPremiereMin.Aff, "%2.2f %s",DebNPremiereMin.Val,DebNPremiereMin.Unit);
becanromain 6:21e96e439978 778 //DEBIT MOYEN DES N DERNIERES MINUTES
becanromain 6:21e96e439978 779 lv_label_set_text_fmt(DebNDerniereMin.Aff, "%2.2f %s",DebNDerniereMin.Val,DebNDerniereMin.Unit);
becanromain 6:21e96e439978 780 //ECART TYPE
becanromain 6:21e96e439978 781 lv_label_set_text_fmt(EcartType.Aff, "%2.2f %s",EcartType.Val,EcartType.Unit);
becanromain 6:21e96e439978 782 //TOTALISATEUR VOLUME
becanromain 6:21e96e439978 783 lv_label_set_text_fmt(TotalisateurVol.Aff, "%8.1f %s",TotalisateurVol.Val,TotalisateurVol.Unit);
becanromain 6:21e96e439978 784 //TOTALISATEUR DUREE
becanromain 6:21e96e439978 785 lv_label_set_text_fmt(TotalisateurDuree.Aff, "%2.2f %s",TotalisateurDuree.Val,TotalisateurDuree.Unit);
becanromain 6:21e96e439978 786 //TENSION
becanromain 6:21e96e439978 787 lv_label_set_text_fmt(TensionBat.Aff, "%2.3f %s",TensionBat.Val,TensionBat.Unit);
becanromain 6:21e96e439978 788 //INTENSITE
becanromain 6:21e96e439978 789 lv_label_set_text_fmt(Intensite.Aff, "%2.3f %s",Intensite.Val,Intensite.Unit);
becanromain 6:21e96e439978 790 //VITESSE POMPE
becanromain 6:21e96e439978 791 lv_label_set_text_fmt(VitessePpe.Aff, "%4.0f %s",VitessePpe.Val,VitessePpe.Unit);
becanromain 6:21e96e439978 792 //CONSOMMATION PRELEVEMENT
becanromain 6:21e96e439978 793 lv_label_set_text_fmt(ConsoPrelev.Aff, "%4.0f %s",ConsoPrelev.Val,ConsoPrelev.Unit);
becanromain 6:21e96e439978 794 //PUISSANCE
becanromain 6:21e96e439978 795 lv_label_set_text_fmt(Puissance.Aff, "%4.0f %s",Puissance.Val,Puissance.Unit);
becanromain 6:21e96e439978 796 }
becanromain 0:cf6b1eca3e67 797
becanromain 6:21e96e439978 798 ////////////////////////////////////////////
becanromain 6:21e96e439978 799 //CREATION PAGE 102: Information générales//
becanromain 6:21e96e439978 800 ////////////////////////////////////////////
becanromain 6:21e96e439978 801 if (Num==102){
becanromain 6:21e96e439978 802 sprintf(Chemin, "%s \\ %s",_("M100"),_("M102"));
becanromain 6:21e96e439978 803 InTxt(_("Nom équipement :"),NomEquipement,5, i=i); //Gabor
becanromain 6:21e96e439978 804 InTxt(_("N°série constructeur :"),NumSerieEquipement,5, i=i+20);
becanromain 6:21e96e439978 805 }
becanromain 6:21e96e439978 806 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 807 if (PageAff==102 and Num==0){
becanromain 6:21e96e439978 808 lv_label_set_text_fmt(NomEquipement.Aff, "%s",NomEquipement.Val); //Gabor
becanromain 6:21e96e439978 809 lv_label_set_text_fmt(NumSerieEquipement.Aff, "%s",NumSerieEquipement.Val);
becanromain 6:21e96e439978 810 }
becanromain 6:21e96e439978 811
becanromain 6:21e96e439978 812 ////////////////////////////////////////////
becanromain 6:21e96e439978 813 //CREATION PAGE 103: Information générales//
becanromain 6:21e96e439978 814 ////////////////////////////////////////////
becanromain 6:21e96e439978 815 if (Num==103){
becanromain 6:21e96e439978 816 // CHEMIN PAGE
becanromain 6:21e96e439978 817 sprintf(Chemin, "%s \\ %s",_("M100"),_("M103"));
becanromain 6:21e96e439978 818
becanromain 6:21e96e439978 819
becanromain 6:21e96e439978 820 PageAff=103;
becanromain 6:21e96e439978 821
becanromain 6:21e96e439978 822 }
becanromain 6:21e96e439978 823 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 824 if (PageAff==103 and Num==0){
becanromain 6:21e96e439978 825
becanromain 6:21e96e439978 826
becanromain 6:21e96e439978 827 }
becanromain 0:cf6b1eca3e67 828
becanromain 6:21e96e439978 829 ////////////////////////////////////////
becanromain 6:21e96e439978 830 //CREATION PAGE 201: Test d'étanchéité//
becanromain 6:21e96e439978 831 ////////////////////////////////////////
becanromain 6:21e96e439978 832 if (Num==201){
becanromain 6:21e96e439978 833 // CHEMIN PAGE
becanromain 6:21e96e439978 834 sprintf(Chemin, "%s \\ %s",_("M200"),_("M201"));
becanromain 6:21e96e439978 835 //affichage données
becanromain 6:21e96e439978 836 /* AffTensionBat = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 837 lv_obj_set_pos(AffTensionBat, 50, i);
becanromain 4:6a3d12663549 838
becanromain 4:6a3d12663549 839 AffTpsCy = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 840 i=i+16;lv_obj_set_pos(AffTpsCy, 50, i);
becanromain 4:6a3d12663549 841
becanromain 4:6a3d12663549 842 AffCptPuls = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 843 i=i+16;lv_obj_set_pos(AffCptPuls, 50, i);
becanromain 4:6a3d12663549 844
becanromain 4:6a3d12663549 845 Aff1TpsEntre2Puls = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 846 i=i+16;lv_obj_set_pos(Aff1TpsEntre2Puls, 50, i);
becanromain 4:6a3d12663549 847
becanromain 4:6a3d12663549 848 Aff2TpsEntre2Puls = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 849 i=i+16;lv_obj_set_pos(Aff2TpsEntre2Puls, 50, i);
becanromain 4:6a3d12663549 850
becanromain 4:6a3d12663549 851 AffTpsMinEntre2Puls = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 852 i=i+16;lv_obj_set_pos(AffTpsMinEntre2Puls, 50, i);
becanromain 0:cf6b1eca3e67 853
becanromain 4:6a3d12663549 854 AffTpsMaxEntre2Puls = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 855 i=i+16;lv_obj_set_pos(AffTpsMaxEntre2Puls, 50, i);
becanromain 4:6a3d12663549 856
becanromain 4:6a3d12663549 857 //BP RAZ
becanromain 4:6a3d12663549 858 BPRAZ = lv_btn_create(Page, NULL);
becanromain 4:6a3d12663549 859 i=i+30;lv_obj_set_pos(BPRAZ, 50, i);
becanromain 4:6a3d12663549 860 label = lv_label_create(BPRAZ, NULL);
becanromain 4:6a3d12663549 861 lv_label_set_text(label, "RAZ");
becanromain 4:6a3d12663549 862 lv_obj_set_size(BPRAZ,60,40);
becanromain 4:6a3d12663549 863 lv_obj_set_event_cb(BPRAZ, BPRAZ_ACT);
becanromain 4:6a3d12663549 864
becanromain 4:6a3d12663549 865 //BP POMPE
becanromain 4:6a3d12663549 866 BPPOMPE = lv_btn_create(Page, NULL);
becanromain 4:6a3d12663549 867 lv_obj_set_pos(BPPOMPE, 150, i);
becanromain 4:6a3d12663549 868 label = lv_label_create(BPPOMPE, NULL);
becanromain 4:6a3d12663549 869 lv_label_set_text(label, "POMPE");
becanromain 4:6a3d12663549 870 lv_obj_set_size(BPPOMPE,90,40);
becanromain 4:6a3d12663549 871 lv_btn_set_toggle(BPPOMPE, true);
becanromain 4:6a3d12663549 872 lv_obj_set_event_cb(BPPOMPE, BPPOMPE_ACT);
becanromain 4:6a3d12663549 873
becanromain 4:6a3d12663549 874 // SLIDER
becanromain 4:6a3d12663549 875 static lv_style_t style_bg,style_knob;
becanromain 6:21e96e439978 876 static lv_style_t style_indic_R;
becanromain 0:cf6b1eca3e67 877
becanromain 4:6a3d12663549 878 lv_style_copy(&style_bg, &lv_style_pretty);
becanromain 4:6a3d12663549 879 style_bg.body.main_color = LV_COLOR_BLACK;
becanromain 4:6a3d12663549 880 style_bg.body.grad_color = LV_COLOR_BLACK;
becanromain 4:6a3d12663549 881 style_bg.body.radius = LV_RADIUS_CIRCLE;
becanromain 4:6a3d12663549 882 style_bg.body.border.color = LV_COLOR_SILVER;
becanromain 0:cf6b1eca3e67 883
becanromain 4:6a3d12663549 884 lv_style_copy(&style_indic_R, &lv_style_pretty_color);
becanromain 4:6a3d12663549 885 style_indic_R.body.main_color = LV_COLOR_RED;
becanromain 4:6a3d12663549 886 style_indic_R.body.grad_color = LV_COLOR_RED;
becanromain 4:6a3d12663549 887 style_indic_R.body.radius = LV_RADIUS_CIRCLE;
becanromain 4:6a3d12663549 888 style_indic_R.body.shadow.width = 4;
becanromain 4:6a3d12663549 889 style_indic_R.body.shadow.color = LV_COLOR_RED;
becanromain 4:6a3d12663549 890 style_indic_R.body.padding.left = 3;
becanromain 4:6a3d12663549 891 style_indic_R.body.padding.right = 3;
becanromain 4:6a3d12663549 892 style_indic_R.body.padding.top = 3;
becanromain 4:6a3d12663549 893 style_indic_R.body.padding.bottom = 3;
becanromain 4:6a3d12663549 894
becanromain 4:6a3d12663549 895 lv_style_copy(&style_knob, &lv_style_pretty);
becanromain 4:6a3d12663549 896 style_knob.body.radius = LV_RADIUS_CIRCLE;
becanromain 4:6a3d12663549 897 style_knob.body.opa = LV_OPA_70;
becanromain 4:6a3d12663549 898 style_knob.body.padding.top = 10 ;
becanromain 4:6a3d12663549 899 style_knob.body.padding.bottom = 10 ;
becanromain 4:6a3d12663549 900
becanromain 6:21e96e439978 901 //Create a slider ROUGE
becanromain 4:6a3d12663549 902 R = lv_slider_create(Page, NULL);
becanromain 4:6a3d12663549 903 lv_obj_set_pos(R, 10, 40);
becanromain 4:6a3d12663549 904 lv_obj_set_width(R, 30);
becanromain 4:6a3d12663549 905 lv_obj_set_height(R, 180);
becanromain 4:6a3d12663549 906 lv_slider_set_range(R, 0, 10000);
becanromain 4:6a3d12663549 907 lv_slider_set_value(R, Reglage_R, false);
becanromain 4:6a3d12663549 908 style_indic_R.body.main_color = LV_COLOR_RED;
becanromain 4:6a3d12663549 909 style_indic_R.body.grad_color = LV_COLOR_RED;
becanromain 4:6a3d12663549 910 style_indic_R.body.shadow.color = LV_COLOR_RED;
becanromain 4:6a3d12663549 911 lv_slider_set_style(R, LV_SLIDER_STYLE_BG, &style_bg);
becanromain 4:6a3d12663549 912 lv_slider_set_style(R, LV_SLIDER_STYLE_INDIC,&style_indic_R);
becanromain 4:6a3d12663549 913 lv_slider_set_style(R, LV_SLIDER_STYLE_KNOB, &style_knob);
becanromain 4:6a3d12663549 914 lv_obj_set_event_cb(R, Reglage_R_RGB);
becanromain 4:6a3d12663549 915 Val_R = lv_label_create(Page, NULL);
becanromain 4:6a3d12663549 916 lv_obj_align(Val_R, R, LV_ALIGN_OUT_TOP_MID, 0, -5);
becanromain 4:6a3d12663549 917 sprintf(text, " %d ", lv_slider_get_value(R));
becanromain 4:6a3d12663549 918 lv_label_set_text(Val_R, text);
becanromain 6:21e96e439978 919 */
becanromain 6:21e96e439978 920
becanromain 6:21e96e439978 921 PageAff=201;
becanromain 6:21e96e439978 922
becanromain 6:21e96e439978 923 }
becanromain 6:21e96e439978 924 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 925 if (PageAff==201 and Num==0){
becanromain 6:21e96e439978 926
becanromain 6:21e96e439978 927 // sprintf(text, _("Temps de cycle = %3.3f us"),TpsCy); lv_label_set_text(AffTpsCy, text);
becanromain 6:21e96e439978 928 // sprintf(text, _("Tension= %3.3f V "),TensionBat ); lv_label_set_text(AffTensionBat, text);
becanromain 6:21e96e439978 929 // sprintf(text, "Temps fonctionnment pompe= %d s",TpsMaPpe ); lv_label_set_text(AffCptPuls, text);
becanromain 6:21e96e439978 930 // sprintf(text, "Nombre d'impulsion= %d ",CptPuls ); lv_label_set_text(AffCptPuls, text);
becanromain 6:21e96e439978 931 // sprintf(text, "Volume = %3.3f L",Volume ); lv_label_set_text(AffVolume, text);
becanromain 6:21e96e439978 932 // sprintf(text, "Debit= %3.3f L/min ",Debit ); lv_label_set_text(AffDebit, text);
becanromain 6:21e96e439978 933 // sprintf(text, "%3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f ",TpsEntre2Puls[1],TpsEntre2Puls[2],TpsEntre2Puls[3],TpsEntre2Puls[4],TpsEntre2Puls[5],TpsEntre2Puls[6],TpsEntre2Puls[7],TpsEntre2Puls[8]); lv_label_set_text(Aff1TpsEntre2Puls, text);
becanromain 6:21e96e439978 934 // sprintf(text, "%3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f / %3.0f ",TpsEntre2Puls[9],TpsEntre2Puls[10],TpsEntre2Puls[11],TpsEntre2Puls[12],TpsEntre2Puls[13],TpsEntre2Puls[14],TpsEntre2Puls[15],TpsEntre2Puls[16]); lv_label_set_text(Aff2TpsEntre2Puls, text);
becanromain 6:21e96e439978 935 // sprintf(text, "Temps mini entre 2 impulsions = %d ",NumSousMenu ); lv_label_set_text(AffTpsMinEntre2Puls, text);
becanromain 6:21e96e439978 936 // sprintf(text, "Temps maxi entre 2 impulsions = %d",test ); lv_label_set_text(AffTpsMaxEntre2Puls, text);
becanromain 6:21e96e439978 937
becanromain 6:21e96e439978 938 }
becanromain 6:21e96e439978 939
becanromain 6:21e96e439978 940 //////////////////////////////////////
becanromain 6:21e96e439978 941 //CREATION PAGE 202: Séquence unique//
becanromain 6:21e96e439978 942 //////////////////////////////////////
becanromain 6:21e96e439978 943 if (Num==202){
becanromain 6:21e96e439978 944 // CHEMIN PAGE
becanromain 6:21e96e439978 945 sprintf(Chemin, "%s \\ %s",_("M200"),_("M202"));
becanromain 6:21e96e439978 946
becanromain 6:21e96e439978 947
becanromain 6:21e96e439978 948 PageAff=202;
becanromain 6:21e96e439978 949
becanromain 6:21e96e439978 950 }
becanromain 6:21e96e439978 951 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 952 if (PageAff==202 and Num==0){
becanromain 6:21e96e439978 953
becanromain 6:21e96e439978 954
becanromain 6:21e96e439978 955 }
becanromain 6:21e96e439978 956 ////////////////////////////////////////
becanromain 6:21e96e439978 957 //CREATION PAGE 203: //
becanromain 6:21e96e439978 958 ////////////////////////////////////////
becanromain 6:21e96e439978 959 if (Num==203){
becanromain 6:21e96e439978 960 // CHEMIN PAGE
becanromain 6:21e96e439978 961 sprintf(Chemin, "%s \\ %s",_("M200"),_("M203"));
becanromain 6:21e96e439978 962
becanromain 6:21e96e439978 963
becanromain 6:21e96e439978 964 PageAff=203;
becanromain 6:21e96e439978 965
becanromain 6:21e96e439978 966 }
becanromain 6:21e96e439978 967 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 968 if (PageAff==203 and Num==0){
becanromain 6:21e96e439978 969
becanromain 6:21e96e439978 970
becanromain 6:21e96e439978 971 }
becanromain 6:21e96e439978 972
becanromain 6:21e96e439978 973 //////////////////////////////////////
becanromain 6:21e96e439978 974 //CREATION PAGE 204: //
becanromain 6:21e96e439978 975 //////////////////////////////////////
becanromain 6:21e96e439978 976 if (Num==204){
becanromain 6:21e96e439978 977 // CHEMIN PAGE
becanromain 6:21e96e439978 978 sprintf(Chemin, "%s \\ %s",_("M200"),_("M204"));
becanromain 6:21e96e439978 979
becanromain 6:21e96e439978 980
becanromain 6:21e96e439978 981 PageAff=204;
becanromain 6:21e96e439978 982
becanromain 6:21e96e439978 983 }
becanromain 6:21e96e439978 984 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 985 if (PageAff==204 and Num==0){
becanromain 6:21e96e439978 986
becanromain 6:21e96e439978 987
becanromain 6:21e96e439978 988 }
becanromain 6:21e96e439978 989
becanromain 6:21e96e439978 990 ////////////////////////////////////////
becanromain 6:21e96e439978 991 //CREATION PAGE 301: //
becanromain 6:21e96e439978 992 ////////////////////////////////////////
becanromain 6:21e96e439978 993 if (Num==301){
becanromain 6:21e96e439978 994 // CHEMIN PAGE
becanromain 6:21e96e439978 995 sprintf(Chemin, "%s \\ %s",_("M300"),_("M301"));
becanromain 6:21e96e439978 996
becanromain 6:21e96e439978 997
becanromain 6:21e96e439978 998 PageAff=301;
becanromain 6:21e96e439978 999
becanromain 6:21e96e439978 1000 }
becanromain 6:21e96e439978 1001 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1002 if (PageAff==301 and Num==0){
becanromain 6:21e96e439978 1003
becanromain 6:21e96e439978 1004
becanromain 6:21e96e439978 1005 }
becanromain 6:21e96e439978 1006
becanromain 6:21e96e439978 1007 //////////////////////////////////////
becanromain 6:21e96e439978 1008 //CREATION PAGE 302: //
becanromain 6:21e96e439978 1009 //////////////////////////////////////
becanromain 6:21e96e439978 1010 if (Num==302){
becanromain 6:21e96e439978 1011 // CHEMIN PAGE
becanromain 6:21e96e439978 1012 sprintf(Chemin, "%s \\ %s",_("M300"),_("M302"));
becanromain 6:21e96e439978 1013
becanromain 6:21e96e439978 1014
becanromain 6:21e96e439978 1015 PageAff=302;
becanromain 6:21e96e439978 1016
becanromain 6:21e96e439978 1017 }
becanromain 6:21e96e439978 1018 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1019 if (PageAff==302 and Num==0){
becanromain 6:21e96e439978 1020
becanromain 6:21e96e439978 1021
becanromain 6:21e96e439978 1022 }
becanromain 6:21e96e439978 1023 ////////////////////////////////////////
becanromain 6:21e96e439978 1024 //CREATION PAGE 303: //
becanromain 6:21e96e439978 1025 ////////////////////////////////////////
becanromain 6:21e96e439978 1026 if (Num==303){
becanromain 6:21e96e439978 1027 // CHEMIN PAGE
becanromain 6:21e96e439978 1028 sprintf(Chemin, "%s \\ %s",_("M300"),_("M303"));
becanromain 6:21e96e439978 1029
becanromain 6:21e96e439978 1030
becanromain 6:21e96e439978 1031 PageAff=303;
becanromain 6:21e96e439978 1032
becanromain 6:21e96e439978 1033 }
becanromain 6:21e96e439978 1034 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1035 if (PageAff==303 and Num==0){
becanromain 6:21e96e439978 1036
becanromain 6:21e96e439978 1037
becanromain 4:6a3d12663549 1038 }
becanromain 4:6a3d12663549 1039
becanromain 6:21e96e439978 1040 //////////////////////////////////////
becanromain 6:21e96e439978 1041 //CREATION PAGE 304: //
becanromain 6:21e96e439978 1042 //////////////////////////////////////
becanromain 6:21e96e439978 1043 if (Num==304){
becanromain 6:21e96e439978 1044 // CHEMIN PAGE
becanromain 6:21e96e439978 1045 sprintf(Chemin, "%s \\ %s",_("M300"),_("M304"));
becanromain 6:21e96e439978 1046
becanromain 6:21e96e439978 1047
becanromain 6:21e96e439978 1048 PageAff=304;
becanromain 6:21e96e439978 1049
becanromain 6:21e96e439978 1050 }
becanromain 6:21e96e439978 1051 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1052 if (PageAff==304 and Num==0){
becanromain 6:21e96e439978 1053
becanromain 6:21e96e439978 1054
becanromain 6:21e96e439978 1055 }
becanromain 6:21e96e439978 1056 //////////////////////////////////////
becanromain 6:21e96e439978 1057 //CREATION PAGE 305: //
becanromain 6:21e96e439978 1058 //////////////////////////////////////
becanromain 6:21e96e439978 1059 if (Num==305){
becanromain 6:21e96e439978 1060 // CHEMIN PAGE
becanromain 6:21e96e439978 1061 sprintf(Chemin, "%s \\ %s",_("M300"),_("M305"));
becanromain 6:21e96e439978 1062
becanromain 6:21e96e439978 1063
becanromain 6:21e96e439978 1064 PageAff=305;
becanromain 6:21e96e439978 1065
becanromain 6:21e96e439978 1066 }
becanromain 6:21e96e439978 1067 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1068 if (PageAff==305 and Num==0){
becanromain 6:21e96e439978 1069
becanromain 6:21e96e439978 1070
becanromain 6:21e96e439978 1071 }
becanromain 6:21e96e439978 1072 //////////////////////////////////////
becanromain 6:21e96e439978 1073 //CREATION PAGE 306: //
becanromain 6:21e96e439978 1074 //////////////////////////////////////
becanromain 6:21e96e439978 1075 if (Num==306){
becanromain 6:21e96e439978 1076 // CHEMIN PAGE
becanromain 6:21e96e439978 1077 sprintf(Chemin, "%s \\ %s",_("M300"),_("M306"));
becanromain 6:21e96e439978 1078
becanromain 6:21e96e439978 1079
becanromain 6:21e96e439978 1080 PageAff=306;
becanromain 6:21e96e439978 1081
becanromain 6:21e96e439978 1082 }
becanromain 6:21e96e439978 1083 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1084 if (PageAff==306 and Num==0){
becanromain 6:21e96e439978 1085
becanromain 6:21e96e439978 1086
becanromain 6:21e96e439978 1087 }
becanromain 6:21e96e439978 1088 ////////////////////////////////////////
becanromain 6:21e96e439978 1089 //CREATION PAGE 401: Test d'étanchéité//
becanromain 6:21e96e439978 1090 ////////////////////////////////////////
becanromain 6:21e96e439978 1091 if (Num==401){
becanromain 6:21e96e439978 1092 // CHEMIN PAGE
becanromain 6:21e96e439978 1093 sprintf(Chemin, "%s \\ %s",_("M400"),_("M401"));
becanromain 6:21e96e439978 1094
becanromain 6:21e96e439978 1095
becanromain 6:21e96e439978 1096 PageAff=401;
becanromain 6:21e96e439978 1097
becanromain 6:21e96e439978 1098 }
becanromain 6:21e96e439978 1099 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1100 if (PageAff==401 and Num==0){
becanromain 6:21e96e439978 1101
becanromain 6:21e96e439978 1102
becanromain 6:21e96e439978 1103 }
becanromain 6:21e96e439978 1104
becanromain 6:21e96e439978 1105 //////////////////////////////////////
becanromain 6:21e96e439978 1106 //CREATION PAGE 402: Séquence unique//
becanromain 6:21e96e439978 1107 //////////////////////////////////////
becanromain 6:21e96e439978 1108 if (Num==402){
becanromain 6:21e96e439978 1109 // CHEMIN PAGE
becanromain 6:21e96e439978 1110 sprintf(Chemin, "%s \\ %s",_("M400"),_("M402"));
becanromain 6:21e96e439978 1111
becanromain 6:21e96e439978 1112
becanromain 6:21e96e439978 1113 PageAff=402;
becanromain 6:21e96e439978 1114
becanromain 6:21e96e439978 1115 }
becanromain 6:21e96e439978 1116 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1117 if (PageAff==402 and Num==0){
becanromain 6:21e96e439978 1118
becanromain 6:21e96e439978 1119
becanromain 6:21e96e439978 1120 }
becanromain 6:21e96e439978 1121 ////////////////////////////////////////
becanromain 6:21e96e439978 1122 //CREATION PAGE 403: //
becanromain 6:21e96e439978 1123 ////////////////////////////////////////
becanromain 6:21e96e439978 1124 if (Num==403){
becanromain 6:21e96e439978 1125 // CHEMIN PAGE
becanromain 6:21e96e439978 1126 sprintf(Chemin, "%s \\ %s",_("M400"),_("M403"));
becanromain 6:21e96e439978 1127
becanromain 6:21e96e439978 1128
becanromain 6:21e96e439978 1129 PageAff=403;
becanromain 4:6a3d12663549 1130
becanromain 6:21e96e439978 1131 }
becanromain 6:21e96e439978 1132 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1133 if (PageAff==403 and Num==0){
becanromain 6:21e96e439978 1134
becanromain 6:21e96e439978 1135
becanromain 6:21e96e439978 1136 }
becanromain 6:21e96e439978 1137
becanromain 6:21e96e439978 1138 //////////////////////////////////////
becanromain 6:21e96e439978 1139 //CREATION PAGE 404: //
becanromain 6:21e96e439978 1140 //////////////////////////////////////
becanromain 6:21e96e439978 1141 if (Num==404){
becanromain 6:21e96e439978 1142 // CHEMIN PAGE
becanromain 6:21e96e439978 1143 sprintf(Chemin, "%s \\ %s",_("M400"),_("M404"));
becanromain 6:21e96e439978 1144
becanromain 6:21e96e439978 1145
becanromain 6:21e96e439978 1146 //CREATION LISTE ETALON POUR AFFICHAGE
becanromain 6:21e96e439978 1147 int i;
becanromain 6:21e96e439978 1148 int j;
becanromain 6:21e96e439978 1149 int k=0;
becanromain 6:21e96e439978 1150 char p[2200];
becanromain 6:21e96e439978 1151 for (i = 1; i < 2200; i++) { p[i]=='\0';}
becanromain 6:21e96e439978 1152
becanromain 6:21e96e439978 1153 for (i = 1; i < 20; i++) {
becanromain 6:21e96e439978 1154 string s=EtalCpt[i].Nom;
becanromain 6:21e96e439978 1155 if (s.length()>0){
becanromain 6:21e96e439978 1156 for (j = 0; j < s.length(); j++) {
becanromain 6:21e96e439978 1157 p[k] = s[j];
becanromain 6:21e96e439978 1158 k++;
becanromain 6:21e96e439978 1159 }
becanromain 6:21e96e439978 1160 p[k]='\n';
becanromain 6:21e96e439978 1161 k++;
becanromain 6:21e96e439978 1162 }
becanromain 6:21e96e439978 1163 }
becanromain 6:21e96e439978 1164 p[k+1]='\0';
becanromain 6:21e96e439978 1165 char * ListeEtal= p ;
becanromain 6:21e96e439978 1166
becanromain 6:21e96e439978 1167 //TITRE TEST
becanromain 6:21e96e439978 1168 lv_obj_t * test = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 1169 lv_label_set_text(test, _("test"));
becanromain 6:21e96e439978 1170 lv_obj_align(test, Page, LV_ALIGN_OUT_TOP_MID, 0, 0);
becanromain 6:21e96e439978 1171
becanromain 6:21e96e439978 1172 //SELECTEUR COMPTEUR ETALON
becanromain 6:21e96e439978 1173 lv_obj_t * SelectEtal = lv_roller_create(Page, NULL);
becanromain 6:21e96e439978 1174 lv_roller_set_options(SelectEtal,ListeEtal,LV_ROLLER_MODE_NORMAL);
becanromain 6:21e96e439978 1175 lv_roller_set_visible_row_count(SelectEtal, 4);
becanromain 6:21e96e439978 1176 lv_roller_set_fix_width(SelectEtal, 130);
becanromain 6:21e96e439978 1177 lv_obj_align(SelectEtal, Page, LV_ALIGN_IN_TOP_LEFT, 10, 20);
becanromain 6:21e96e439978 1178
becanromain 6:21e96e439978 1179 //TITRE COMPTEUR ETALON
becanromain 6:21e96e439978 1180 lv_obj_t * Titre = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 1181 lv_label_set_text(Titre, _("COMPTEUR"));
becanromain 6:21e96e439978 1182 lv_obj_align(Titre, SelectEtal, LV_ALIGN_OUT_TOP_MID, 0, 0);
becanromain 6:21e96e439978 1183
becanromain 6:21e96e439978 1184 //BP MODIFIER
becanromain 6:21e96e439978 1185 lv_obj_t * BPModifCompt = lv_btn_create(Page, NULL);
becanromain 6:21e96e439978 1186 // StyleBPSM(BPModifCompt);
becanromain 6:21e96e439978 1187 lv_obj_set_size(BPModifCompt,130,30);
becanromain 6:21e96e439978 1188 lv_obj_align(BPModifCompt, SelectEtal, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 1189 label = lv_label_create(BPModifCompt, NULL);
becanromain 6:21e96e439978 1190 lv_label_set_text(label, _("Modifier"));
becanromain 6:21e96e439978 1191 // lv_obj_set_event_cb(BPModifCompt, BPModifCompt_ACT);
becanromain 6:21e96e439978 1192
becanromain 6:21e96e439978 1193 //BP AJOUTER
becanromain 6:21e96e439978 1194 lv_obj_t * BPAjoutCompt = lv_btn_create(Page, NULL);
becanromain 6:21e96e439978 1195 // StyleBPSM(BPAjoutCompt);
becanromain 6:21e96e439978 1196 lv_obj_set_size(BPAjoutCompt,130,30);
becanromain 6:21e96e439978 1197 lv_obj_align(BPAjoutCompt, BPModifCompt, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 1198 label = lv_label_create(BPAjoutCompt, NULL);
becanromain 6:21e96e439978 1199 lv_label_set_text(label, _("Ajouter"));
becanromain 6:21e96e439978 1200 // lv_obj_set_event_cb(BPAjoutCompt, BPAjoutCompt_ACT);
becanromain 6:21e96e439978 1201
becanromain 6:21e96e439978 1202 //BP SUPPRIMER
becanromain 6:21e96e439978 1203 lv_obj_t * BPSupprCompt = lv_btn_create(Page, NULL);
becanromain 6:21e96e439978 1204 // StyleBPSM(BPModifCompt);
becanromain 6:21e96e439978 1205 lv_obj_set_size(BPSupprCompt,130,30);
becanromain 6:21e96e439978 1206 lv_obj_align(BPSupprCompt, BPAjoutCompt, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 1207 label = lv_label_create(BPSupprCompt, NULL);
becanromain 6:21e96e439978 1208 lv_label_set_text(label, _("Supprimer"));
becanromain 6:21e96e439978 1209 // lv_obj_set_event_cb(BPSupprCompt, BPSupprCompt_ACT);
becanromain 6:21e96e439978 1210
becanromain 6:21e96e439978 1211 PageAff=404;
becanromain 6:21e96e439978 1212
becanromain 6:21e96e439978 1213 }
becanromain 6:21e96e439978 1214 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1215 if (PageAff==404 and Num==0){
becanromain 6:21e96e439978 1216
becanromain 6:21e96e439978 1217
becanromain 6:21e96e439978 1218 }
becanromain 6:21e96e439978 1219 //////////////////////////////////////
becanromain 6:21e96e439978 1220 //CREATION PAGE 405: //
becanromain 6:21e96e439978 1221 //////////////////////////////////////
becanromain 6:21e96e439978 1222 if (Num==405){
becanromain 6:21e96e439978 1223 // CHEMIN PAGE
becanromain 6:21e96e439978 1224 sprintf(Chemin, "%s \\ %s",_("M400"),_("M405"));
becanromain 6:21e96e439978 1225
becanromain 6:21e96e439978 1226
becanromain 6:21e96e439978 1227 PageAff=405;
becanromain 6:21e96e439978 1228
becanromain 6:21e96e439978 1229 }
becanromain 6:21e96e439978 1230 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1231 if (PageAff==405 and Num==0){
becanromain 6:21e96e439978 1232
becanromain 6:21e96e439978 1233
becanromain 6:21e96e439978 1234 }
becanromain 6:21e96e439978 1235 //////////////////////////////////////
becanromain 6:21e96e439978 1236 //CREATION PAGE 406: //
becanromain 6:21e96e439978 1237 //////////////////////////////////////
becanromain 6:21e96e439978 1238 if (Num==406){
becanromain 6:21e96e439978 1239 // CHEMIN PAGE
becanromain 6:21e96e439978 1240 sprintf(Chemin, "%s \\ %s",_("M400"),_("M406"));
becanromain 6:21e96e439978 1241
becanromain 6:21e96e439978 1242
becanromain 6:21e96e439978 1243 PageAff=406;
becanromain 6:21e96e439978 1244
becanromain 6:21e96e439978 1245 }
becanromain 6:21e96e439978 1246 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1247 if (PageAff==406 and Num==0){
becanromain 6:21e96e439978 1248
becanromain 6:21e96e439978 1249
becanromain 6:21e96e439978 1250 }
becanromain 6:21e96e439978 1251
becanromain 6:21e96e439978 1252 ///////////////////////////////////////
becanromain 6:21e96e439978 1253 //CREATION PAGE 501: Sélection langue//
becanromain 6:21e96e439978 1254 ///////////////////////////////////////
becanromain 6:21e96e439978 1255 if (Num==501){
becanromain 6:21e96e439978 1256 // CHEMIN PAGE
becanromain 6:21e96e439978 1257 sprintf(Chemin, "%s \\ %s",_("M500"),_("M501"));
becanromain 6:21e96e439978 1258
becanromain 4:6a3d12663549 1259 //BP SELECTION LANGUE: FRANCAIS
becanromain 4:6a3d12663549 1260 lv_obj_t * LANGUE_FR = lv_btn_create(Page, NULL);
becanromain 4:6a3d12663549 1261 lv_obj_align(LANGUE_FR, Page, LV_ALIGN_IN_TOP_MID, -80, 50);
becanromain 4:6a3d12663549 1262 label = lv_label_create(LANGUE_FR, NULL);
becanromain 4:6a3d12663549 1263 lv_label_set_text(label, _("Francais"));
becanromain 4:6a3d12663549 1264 lv_obj_set_size(LANGUE_FR,100,40);
becanromain 4:6a3d12663549 1265 lv_obj_set_event_cb(LANGUE_FR, LANGUE_FR_ACT);
becanromain 4:6a3d12663549 1266
becanromain 4:6a3d12663549 1267 //BP SELECTION LANGUE: ANGLAIS
becanromain 4:6a3d12663549 1268 lv_obj_t * LANGUE_EN = lv_btn_create(Page, NULL);
becanromain 4:6a3d12663549 1269 lv_obj_align(LANGUE_EN, Page, LV_ALIGN_IN_TOP_MID, 80, 50);
becanromain 4:6a3d12663549 1270 label = lv_label_create(LANGUE_EN, NULL);
becanromain 4:6a3d12663549 1271 lv_label_set_text(label, _("English"));
becanromain 4:6a3d12663549 1272 lv_obj_set_size(LANGUE_EN,100,40);
becanromain 6:21e96e439978 1273 lv_obj_set_event_cb(LANGUE_EN, LANGUE_EN_ACT);
becanromain 6:21e96e439978 1274
becanromain 6:21e96e439978 1275 PageAff=501;
becanromain 6:21e96e439978 1276 }
becanromain 6:21e96e439978 1277 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1278 if (PageAff==501 and Num==0){
becanromain 6:21e96e439978 1279
becanromain 6:21e96e439978 1280 }
becanromain 6:21e96e439978 1281
becanromain 6:21e96e439978 1282 //////////////////////////////////////
becanromain 6:21e96e439978 1283 //CREATION PAGE 502: Séquence unique//
becanromain 6:21e96e439978 1284 //////////////////////////////////////
becanromain 6:21e96e439978 1285 if (Num==502){
becanromain 6:21e96e439978 1286 // CHEMIN PAGE
becanromain 6:21e96e439978 1287 sprintf(Chemin, "%s \\ %s",_("M500"),_("M502"));
becanromain 6:21e96e439978 1288
becanromain 6:21e96e439978 1289
becanromain 6:21e96e439978 1290 PageAff=502;
becanromain 6:21e96e439978 1291
becanromain 6:21e96e439978 1292 }
becanromain 6:21e96e439978 1293 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1294 if (PageAff==502 and Num==0){
becanromain 6:21e96e439978 1295
becanromain 6:21e96e439978 1296
becanromain 6:21e96e439978 1297 }
becanromain 6:21e96e439978 1298 ////////////////////////////////////////
becanromain 6:21e96e439978 1299 //CREATION PAGE 503: //
becanromain 6:21e96e439978 1300 ////////////////////////////////////////
becanromain 6:21e96e439978 1301 if (Num==503){
becanromain 6:21e96e439978 1302 // CHEMIN PAGE
becanromain 6:21e96e439978 1303 sprintf(Chemin, "%s \\ %s",_("M500"),_("M503"));
becanromain 6:21e96e439978 1304
becanromain 6:21e96e439978 1305
becanromain 6:21e96e439978 1306 PageAff=503;
becanromain 6:21e96e439978 1307
becanromain 6:21e96e439978 1308 }
becanromain 6:21e96e439978 1309 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1310 if (PageAff==503 and Num==0){
becanromain 6:21e96e439978 1311
becanromain 6:21e96e439978 1312
becanromain 6:21e96e439978 1313 }
becanromain 6:21e96e439978 1314
becanromain 6:21e96e439978 1315 //////////////////////////////////////
becanromain 6:21e96e439978 1316 //CREATION PAGE 504: //
becanromain 6:21e96e439978 1317 //////////////////////////////////////
becanromain 6:21e96e439978 1318 if (Num==504){
becanromain 6:21e96e439978 1319 // CHEMIN PAGE
becanromain 6:21e96e439978 1320 sprintf(Chemin, "%s \\ %s",_("M500"),_("M504"));
becanromain 6:21e96e439978 1321
becanromain 6:21e96e439978 1322
becanromain 6:21e96e439978 1323 PageAff=504;
becanromain 6:21e96e439978 1324
becanromain 6:21e96e439978 1325 }
becanromain 6:21e96e439978 1326 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1327 if (PageAff==504 and Num==0){
becanromain 6:21e96e439978 1328
becanromain 6:21e96e439978 1329
becanromain 6:21e96e439978 1330 }
becanromain 6:21e96e439978 1331 //////////////////////////////////////
becanromain 6:21e96e439978 1332 //CREATION PAGE 505: //
becanromain 6:21e96e439978 1333 //////////////////////////////////////
becanromain 6:21e96e439978 1334 if (Num==505){
becanromain 6:21e96e439978 1335 // CHEMIN PAGE
becanromain 6:21e96e439978 1336 sprintf(Chemin, "%s \\ %s",_("M500"),_("M505"));
becanromain 6:21e96e439978 1337
becanromain 6:21e96e439978 1338
becanromain 6:21e96e439978 1339 PageAff=505;
becanromain 6:21e96e439978 1340
becanromain 6:21e96e439978 1341 }
becanromain 6:21e96e439978 1342 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1343 if (PageAff==505 and Num==0){
becanromain 6:21e96e439978 1344
becanromain 6:21e96e439978 1345
becanromain 6:21e96e439978 1346 }
becanromain 6:21e96e439978 1347 //////////////////////////////////////
becanromain 6:21e96e439978 1348 //CREATION PAGE 506: //
becanromain 6:21e96e439978 1349 //////////////////////////////////////
becanromain 6:21e96e439978 1350 if (Num==506){
becanromain 6:21e96e439978 1351 // CHEMIN PAGE
becanromain 6:21e96e439978 1352 sprintf(Chemin, "%s \\ %s",_("M500"),_("M506"));
becanromain 6:21e96e439978 1353
becanromain 6:21e96e439978 1354
becanromain 6:21e96e439978 1355 PageAff=506;
becanromain 6:21e96e439978 1356
becanromain 6:21e96e439978 1357 }
becanromain 6:21e96e439978 1358 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1359 if (PageAff==506 and Num==0){
becanromain 6:21e96e439978 1360
becanromain 6:21e96e439978 1361
becanromain 6:21e96e439978 1362 }
becanromain 6:21e96e439978 1363 ////////////////////////////////////////
becanromain 6:21e96e439978 1364 //CREATION PAGE 601: Test d'étanchéité//
becanromain 6:21e96e439978 1365 ////////////////////////////////////////
becanromain 6:21e96e439978 1366 if (Num==601){
becanromain 6:21e96e439978 1367 // CHEMIN PAGE
becanromain 6:21e96e439978 1368 sprintf(Chemin, "%s \\ %s",_("M600"),_("M601"));
becanromain 6:21e96e439978 1369
becanromain 6:21e96e439978 1370
becanromain 6:21e96e439978 1371 PageAff=601;
becanromain 6:21e96e439978 1372
becanromain 6:21e96e439978 1373 }
becanromain 6:21e96e439978 1374 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1375 if (PageAff==601 and Num==0){
becanromain 6:21e96e439978 1376
becanromain 6:21e96e439978 1377
becanromain 6:21e96e439978 1378 }
becanromain 6:21e96e439978 1379
becanromain 6:21e96e439978 1380 //////////////////////////////////////
becanromain 6:21e96e439978 1381 //CREATION PAGE 602: Séquence unique//
becanromain 6:21e96e439978 1382 //////////////////////////////////////
becanromain 6:21e96e439978 1383 if (Num==602){
becanromain 6:21e96e439978 1384 // CHEMIN PAGE
becanromain 6:21e96e439978 1385 sprintf(Chemin, "%s \\ %s",_("M600"),_("M602"));
becanromain 6:21e96e439978 1386
becanromain 6:21e96e439978 1387
becanromain 6:21e96e439978 1388 PageAff=602;
becanromain 6:21e96e439978 1389
becanromain 6:21e96e439978 1390 }
becanromain 6:21e96e439978 1391 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1392 if (PageAff==602 and Num==0){
becanromain 6:21e96e439978 1393
becanromain 6:21e96e439978 1394
becanromain 6:21e96e439978 1395 }
becanromain 6:21e96e439978 1396 ////////////////////////////////////////
becanromain 6:21e96e439978 1397 //CREATION PAGE 603: //
becanromain 6:21e96e439978 1398 ////////////////////////////////////////
becanromain 6:21e96e439978 1399 if (Num==603){
becanromain 6:21e96e439978 1400 // CHEMIN PAGE
becanromain 6:21e96e439978 1401 sprintf(Chemin, "%s \\ %s",_("M600"),_("M603"));
becanromain 6:21e96e439978 1402
becanromain 6:21e96e439978 1403
becanromain 6:21e96e439978 1404 PageAff=603;
becanromain 6:21e96e439978 1405
becanromain 6:21e96e439978 1406 }
becanromain 6:21e96e439978 1407 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1408 if (PageAff==603 and Num==0){
becanromain 6:21e96e439978 1409
becanromain 6:21e96e439978 1410
becanromain 6:21e96e439978 1411 }
becanromain 6:21e96e439978 1412
becanromain 6:21e96e439978 1413 //////////////////////////////////////
becanromain 6:21e96e439978 1414 //CREATION PAGE 604: //
becanromain 6:21e96e439978 1415 //////////////////////////////////////
becanromain 6:21e96e439978 1416 if (Num==604){
becanromain 6:21e96e439978 1417 // CHEMIN PAGE
becanromain 6:21e96e439978 1418 sprintf(Chemin, "%s \\ %s",_("M600"),_("M604"));
becanromain 6:21e96e439978 1419
becanromain 6:21e96e439978 1420
becanromain 6:21e96e439978 1421 PageAff=604;
becanromain 6:21e96e439978 1422
becanromain 6:21e96e439978 1423 }
becanromain 6:21e96e439978 1424 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1425 if (PageAff==604 and Num==0){
becanromain 6:21e96e439978 1426
becanromain 6:21e96e439978 1427
becanromain 6:21e96e439978 1428 }
becanromain 6:21e96e439978 1429 //////////////////////////////////////
becanromain 6:21e96e439978 1430 //CREATION PAGE 605: //
becanromain 6:21e96e439978 1431 //////////////////////////////////////
becanromain 6:21e96e439978 1432 if (Num==605){
becanromain 6:21e96e439978 1433 // CHEMIN PAGE
becanromain 6:21e96e439978 1434 sprintf(Chemin, "%s \\ %s",_("M600"),_("M605"));
becanromain 6:21e96e439978 1435
becanromain 6:21e96e439978 1436
becanromain 6:21e96e439978 1437 PageAff=605;
becanromain 6:21e96e439978 1438
becanromain 6:21e96e439978 1439 }
becanromain 6:21e96e439978 1440 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1441 if (PageAff==605 and Num==0){
becanromain 6:21e96e439978 1442
becanromain 6:21e96e439978 1443
becanromain 6:21e96e439978 1444 }
becanromain 6:21e96e439978 1445 //////////////////////////////////////
becanromain 6:21e96e439978 1446 //CREATION PAGE 606: //
becanromain 6:21e96e439978 1447 //////////////////////////////////////
becanromain 6:21e96e439978 1448 if (Num==606){
becanromain 6:21e96e439978 1449 // CHEMIN PAGE
becanromain 6:21e96e439978 1450 sprintf(Chemin, "%s \\ %s",_("M600"),_("M606"));
becanromain 6:21e96e439978 1451
becanromain 6:21e96e439978 1452
becanromain 6:21e96e439978 1453 PageAff=606;
becanromain 6:21e96e439978 1454
becanromain 6:21e96e439978 1455 }
becanromain 6:21e96e439978 1456 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1457 if (PageAff==606 and Num==0){
becanromain 6:21e96e439978 1458
becanromain 6:21e96e439978 1459
becanromain 6:21e96e439978 1460 }
becanromain 6:21e96e439978 1461 ////////////////////////////////////////
becanromain 6:21e96e439978 1462 //CREATION PAGE 701:??????????????????//
becanromain 6:21e96e439978 1463 ////////////////////////////////////////
becanromain 6:21e96e439978 1464 if (Num==701){
becanromain 6:21e96e439978 1465 // CHEMIN PAGE
becanromain 6:21e96e439978 1466 sprintf(Chemin, "%s \\ %s",_("M700"),_("M701"));
becanromain 6:21e96e439978 1467
becanromain 6:21e96e439978 1468 //Programme en cours
becanromain 6:21e96e439978 1469 lv_obj_t *ProgEC = lv_label_create(Page, NULL);
becanromain 6:21e96e439978 1470 lv_obj_set_pos(ProgEC, 50, i);
becanromain 6:21e96e439978 1471
becanromain 6:21e96e439978 1472 PageAff=401;
becanromain 6:21e96e439978 1473
becanromain 6:21e96e439978 1474 }
becanromain 6:21e96e439978 1475 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1476 if (PageAff==701 and Num==0){
becanromain 6:21e96e439978 1477
becanromain 6:21e96e439978 1478 }
becanromain 6:21e96e439978 1479
becanromain 6:21e96e439978 1480 //////////////////////////////////////
becanromain 6:21e96e439978 1481 //CREATION PAGE 702: Séquence unique//
becanromain 6:21e96e439978 1482 //////////////////////////////////////
becanromain 6:21e96e439978 1483 if (Num==702){
becanromain 6:21e96e439978 1484 // CHEMIN PAGE
becanromain 6:21e96e439978 1485 sprintf(Chemin, "%s \\ %s",_("M700"),_("M702"));
becanromain 6:21e96e439978 1486
becanromain 6:21e96e439978 1487
becanromain 6:21e96e439978 1488 PageAff=702;
becanromain 6:21e96e439978 1489
becanromain 6:21e96e439978 1490 }
becanromain 6:21e96e439978 1491 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1492 if (PageAff==702 and Num==0){
becanromain 6:21e96e439978 1493
becanromain 6:21e96e439978 1494
becanromain 6:21e96e439978 1495 }
becanromain 6:21e96e439978 1496 ////////////////////////////////////////
becanromain 6:21e96e439978 1497 //CREATION PAGE 703: //
becanromain 6:21e96e439978 1498 ////////////////////////////////////////
becanromain 6:21e96e439978 1499 if (Num==703){
becanromain 6:21e96e439978 1500 // CHEMIN PAGE
becanromain 6:21e96e439978 1501 sprintf(Chemin, "%s \\ %s",_("M700"),_("M703"));
becanromain 6:21e96e439978 1502
becanromain 6:21e96e439978 1503
becanromain 6:21e96e439978 1504 PageAff=703;
becanromain 6:21e96e439978 1505
becanromain 6:21e96e439978 1506 }
becanromain 6:21e96e439978 1507 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1508 if (PageAff==703 and Num==0){
becanromain 6:21e96e439978 1509
becanromain 6:21e96e439978 1510
becanromain 4:6a3d12663549 1511 }
becanromain 4:6a3d12663549 1512
becanromain 6:21e96e439978 1513 //////////////////////////////////////
becanromain 6:21e96e439978 1514 //CREATION PAGE 704: //
becanromain 6:21e96e439978 1515 //////////////////////////////////////
becanromain 6:21e96e439978 1516 if (Num==704){
becanromain 6:21e96e439978 1517 // CHEMIN PAGE
becanromain 6:21e96e439978 1518 sprintf(Chemin, "%s \\ %s",_("M700"),_("M704"));
becanromain 6:21e96e439978 1519
becanromain 6:21e96e439978 1520
becanromain 6:21e96e439978 1521 PageAff=704;
becanromain 6:21e96e439978 1522
becanromain 6:21e96e439978 1523 }
becanromain 6:21e96e439978 1524 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1525 if (PageAff==704 and Num==0){
becanromain 6:21e96e439978 1526
becanromain 6:21e96e439978 1527
becanromain 6:21e96e439978 1528 }
becanromain 6:21e96e439978 1529 //////////////////////////////////////
becanromain 6:21e96e439978 1530 //CREATION PAGE 705: //
becanromain 6:21e96e439978 1531 //////////////////////////////////////
becanromain 6:21e96e439978 1532 if (Num==705){
becanromain 6:21e96e439978 1533 // CHEMIN PAGE
becanromain 6:21e96e439978 1534 sprintf(Chemin, "%s \\ %s",_("M700"),_("M705"));
becanromain 6:21e96e439978 1535
becanromain 6:21e96e439978 1536
becanromain 6:21e96e439978 1537 PageAff=705;
becanromain 6:21e96e439978 1538
becanromain 6:21e96e439978 1539 }
becanromain 6:21e96e439978 1540 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1541 if (PageAff==705 and Num==0){
becanromain 6:21e96e439978 1542
becanromain 6:21e96e439978 1543
becanromain 6:21e96e439978 1544 }
becanromain 6:21e96e439978 1545 //////////////////////////////////////
becanromain 6:21e96e439978 1546 //CREATION PAGE 706: //
becanromain 6:21e96e439978 1547 //////////////////////////////////////
becanromain 6:21e96e439978 1548 if (Num==706){
becanromain 6:21e96e439978 1549 // CHEMIN PAGE
becanromain 6:21e96e439978 1550 sprintf(Chemin, "%s \\ %s",_("M700"),_("M706"));
becanromain 6:21e96e439978 1551
becanromain 6:21e96e439978 1552
becanromain 6:21e96e439978 1553 PageAff=706;
becanromain 6:21e96e439978 1554
becanromain 6:21e96e439978 1555 }
becanromain 6:21e96e439978 1556 //RAFFRAICHISSEMENT DONNEES
becanromain 6:21e96e439978 1557 if (PageAff==706 and Num==0){
becanromain 6:21e96e439978 1558
becanromain 6:21e96e439978 1559
becanromain 6:21e96e439978 1560 }
becanromain 6:21e96e439978 1561 }
becanromain 0:cf6b1eca3e67 1562
becanromain 6:21e96e439978 1563 //FONCTION INTERRUPTION COMPTEUR D'IMPULSION
becanromain 6:21e96e439978 1564 void interruptCompteur()
becanromain 6:21e96e439978 1565 {
becanromain 6:21e96e439978 1566 //Timestamp pulsation
becanromain 6:21e96e439978 1567 TimerPuls=tempo.read_high_resolution_us();
becanromain 6:21e96e439978 1568
becanromain 6:21e96e439978 1569 // Calcul temps entre 2 impulsions
becanromain 6:21e96e439978 1570 TpsPuls=TimerPuls-MemTpsPuls;
becanromain 6:21e96e439978 1571 MemTpsPuls=TimerPuls;
becanromain 6:21e96e439978 1572
becanromain 6:21e96e439978 1573 //Incrementation numéro de dent roue
becanromain 6:21e96e439978 1574 NumDent++;
becanromain 6:21e96e439978 1575
becanromain 6:21e96e439978 1576 //Memorisation ecart entre chaque impulsion et Calcul des Min Max
becanromain 6:21e96e439978 1577 Calcul=TpsPuls;
becanromain 6:21e96e439978 1578 Calcul=Calcul/1000;
becanromain 6:21e96e439978 1579 TpsEntre2Puls[NumDent]=Calcul;
becanromain 6:21e96e439978 1580 if (Calcul<TpsMinEntre2Puls){TpsMinEntre2Puls=Calcul;}
becanromain 6:21e96e439978 1581 if (Calcul>TpsMaxEntre2Puls){TpsMaxEntre2Puls=Calcul;}
becanromain 6:21e96e439978 1582
becanromain 6:21e96e439978 1583 //Calcul débit
becanromain 6:21e96e439978 1584 if (NumDent>=16){
becanromain 6:21e96e439978 1585 CalcDebit=VolParTour;
becanromain 6:21e96e439978 1586 CalcDebit=60000000*CalcDebit/(TimerPuls-MemTps16Puls);
becanromain 6:21e96e439978 1587 Debit.Val=CalcDebit;
becanromain 6:21e96e439978 1588 Debit.Val=Debit.Val/1000;
becanromain 6:21e96e439978 1589 MemTps16Puls=TimerPuls;
becanromain 6:21e96e439978 1590 NumDent=0;
becanromain 6:21e96e439978 1591 }
becanromain 6:21e96e439978 1592
becanromain 6:21e96e439978 1593 //Nombre d'impulsion total
becanromain 6:21e96e439978 1594 CptPuls++;
becanromain 6:21e96e439978 1595
becanromain 6:21e96e439978 1596 //Calcul Volume
becanromain 6:21e96e439978 1597 Volume.Val=CptPuls*VolParTour/16000;
becanromain 6:21e96e439978 1598
becanromain 6:21e96e439978 1599 }
becanromain 6:21e96e439978 1600
becanromain 6:21e96e439978 1601 void initialisation(void)
becanromain 6:21e96e439978 1602 {
becanromain 6:21e96e439978 1603 //CHARGEMENT DU THEME
becanromain 6:21e96e439978 1604 th_act = lv_theme_rb_init(0, &RB_lv_font_roboto_16); //Gabor: When i change something in my Theme nothing's happen. Can you see in /lvgl_RB/lv_theme_rb.c
becanromain 6:21e96e439978 1605
becanromain 6:21e96e439978 1606 // th_act = lv_theme_rb_init(0, NULL); //Gabor: When i change something in my Theme nothing's happen. Can you see in /lvgl_RB/lv_theme_rb.c
becanromain 6:21e96e439978 1607 // th_act = lv_theme_night_init(0, NULL);
becanromain 6:21e96e439978 1608 lv_theme_set_current(th_act);
becanromain 6:21e96e439978 1609
becanromain 6:21e96e439978 1610 lv_obj_t * scr = lv_obj_create(NULL, NULL);
becanromain 6:21e96e439978 1611 lv_disp_load_scr(scr);
becanromain 6:21e96e439978 1612
becanromain 6:21e96e439978 1613 //POLICES
becanromain 6:21e96e439978 1614 lv_style_copy(&P10, &lv_style_pretty); P10.text.font = &RB_lv_font_roboto_10;
becanromain 6:21e96e439978 1615 lv_style_copy(&P12, &lv_style_pretty); P12.text.font = &RB_lv_font_roboto_12;
becanromain 6:21e96e439978 1616 lv_style_copy(&P16, &lv_style_pretty); P16.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 1617 lv_style_copy(&P18, &lv_style_pretty); P18.text.font = &RB_lv_font_roboto_18;
becanromain 6:21e96e439978 1618 lv_style_copy(&P22, &lv_style_pretty); P22.text.font = &RB_lv_font_roboto_22;
becanromain 6:21e96e439978 1619 lv_style_copy(&PG12, &lv_style_pretty); PG12.text.font = &RB_lv_font_roboto_bold_12;
becanromain 6:21e96e439978 1620 lv_style_copy(&PG16, &lv_style_pretty); PG16.text.font = &RB_lv_font_roboto_bold_16;
becanromain 6:21e96e439978 1621 lv_style_copy(&PG18, &lv_style_pretty); PG18.text.font = &RB_lv_font_roboto_bold_18;
becanromain 6:21e96e439978 1622 lv_style_copy(&PG22, &lv_style_pretty); PG22.text.font = &RB_lv_font_roboto_bold_22;
becanromain 6:21e96e439978 1623
becanromain 6:21e96e439978 1624 lv_style_copy(&P16Saisie, &lv_style_pretty); P16Saisie.text.font = &RB_lv_font_roboto_16; P16Saisie.text.color = LV_COLOR_MAKE(0, 0, 255);
becanromain 6:21e96e439978 1625
becanromain 6:21e96e439978 1626
becanromain 6:21e96e439978 1627 //INITIALISATION TABLEAU UTILISATEUR
becanromain 6:21e96e439978 1628 User[1].Nom="Romain BECAN"; User[1].MDP="1234"; User[1].Niveau=3; User[1].Tps=1;
becanromain 6:21e96e439978 1629 User[2].Nom="Guy HERVE"; User[2].MDP="5678"; User[2].Niveau=2; User[2].Tps=120;
becanromain 6:21e96e439978 1630 User[31].Nom="OPERATEUR 1"; User[31].MDP="4321"; User[31].Niveau=1; User[31].Tps=1;
becanromain 6:21e96e439978 1631 User[32].Nom="OPERATEUR 2"; User[32].MDP="4321"; User[32].Niveau=1; User[32].Tps=60;
becanromain 6:21e96e439978 1632 User[33].Nom="OPERATEUR 3"; User[33].MDP="4321"; User[33].Niveau=1; User[33].Tps=70;
becanromain 6:21e96e439978 1633 User[34].Nom="OPERATEUR 4"; User[34].MDP="4321"; User[34].Niveau=1; User[34].Tps=30;
becanromain 6:21e96e439978 1634 User[35].Nom="OPERATEUR 5"; User[35].MDP="4321"; User[35].Niveau=3; User[35].Tps=30;
becanromain 6:21e96e439978 1635 User[36].Nom="OPERATEUR 6"; User[36].MDP="4321"; User[36].Niveau=3; User[36].Tps=30;
becanromain 6:21e96e439978 1636 User[99].Nom="OPERATEUR 100"; User[99].MDP="4321"; User[99].Niveau=3; User[99].Tps=30;
becanromain 6:21e96e439978 1637
becanromain 6:21e96e439978 1638
becanromain 6:21e96e439978 1639 //INITIALISATION TABLEAU ETALON
becanromain 6:21e96e439978 1640 EtalCpt[1].Nom="COMPT AB1"; EtalCpt[1].ValPuls=68.38; EtalCpt[1].EMT=5.0;
becanromain 6:21e96e439978 1641 EtalCpt[1].Hist[1].Annee=2020; EtalCpt[1].Hist[1].Mois=01; EtalCpt[1].Hist[1].ProvDeriv1=1.2; EtalCpt[1].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1642 EtalCpt[1].Hist[1].Annee=2019; EtalCpt[1].Hist[1].Mois=02; EtalCpt[1].Hist[1].ProvDeriv1=1.3; EtalCpt[1].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1643 EtalCpt[1].Hist[1].Annee=2018; EtalCpt[1].Hist[1].Mois=10; EtalCpt[1].Hist[1].ProvDeriv1=1.4; EtalCpt[1].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1644 EtalCpt[1].Hist[1].Annee=2017; EtalCpt[1].Hist[1].Mois=03; EtalCpt[1].Hist[1].ProvDeriv1=1.5; EtalCpt[1].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1645 EtalCpt[1].Hist[1].Annee=2016; EtalCpt[1].Hist[1].Mois=04; EtalCpt[1].Hist[1].ProvDeriv1=1.6; EtalCpt[1].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1646 EtalCpt[2].Nom="COMPT 123"; EtalCpt[2].ValPuls=66.35; EtalCpt[2].EMT=5.0;
becanromain 6:21e96e439978 1647 EtalCpt[2].Hist[1].Annee=2020; EtalCpt[2].Hist[1].Mois=01; EtalCpt[2].Hist[1].ProvDeriv1=1.2; EtalCpt[2].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1648 EtalCpt[2].Hist[1].Annee=2019; EtalCpt[2].Hist[1].Mois=02; EtalCpt[2].Hist[1].ProvDeriv1=1.3; EtalCpt[2].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1649 EtalCpt[2].Hist[1].Annee=2018; EtalCpt[2].Hist[1].Mois=10; EtalCpt[2].Hist[1].ProvDeriv1=1.4; EtalCpt[2].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1650 EtalCpt[2].Hist[1].Annee=2017; EtalCpt[2].Hist[1].Mois=03; EtalCpt[2].Hist[1].ProvDeriv1=1.5; EtalCpt[2].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1651 EtalCpt[2].Hist[1].Annee=2016; EtalCpt[2].Hist[1].Mois=04; EtalCpt[2].Hist[1].ProvDeriv1=1.6; EtalCpt[2].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1652 EtalCpt[3].Nom="COMPT 446"; EtalCpt[3].ValPuls=64.18; EtalCpt[3].EMT=5.0;
becanromain 6:21e96e439978 1653 EtalCpt[3].Hist[1].Annee=2020; EtalCpt[3].Hist[1].Mois=01; EtalCpt[3].Hist[1].ProvDeriv1=1.2; EtalCpt[3].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1654 EtalCpt[3].Hist[1].Annee=2019; EtalCpt[3].Hist[1].Mois=02; EtalCpt[3].Hist[1].ProvDeriv1=1.3; EtalCpt[3].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1655 EtalCpt[3].Hist[1].Annee=2018; EtalCpt[3].Hist[1].Mois=10; EtalCpt[3].Hist[1].ProvDeriv1=1.4; EtalCpt[3].Hist[1].Ajustage=false;
becanromain 6:21e96e439978 1656 EtalCpt[3].Hist[1].Annee=2017; EtalCpt[3].Hist[1].Mois=03; EtalCpt[3].Hist[1].ProvDeriv1=1.5; EtalCpt[3].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1657 EtalCpt[3].Hist[1].Annee=2016; EtalCpt[3].Hist[1].Mois=04; EtalCpt[3].Hist[1].ProvDeriv1=1.6; EtalCpt[3].Hist[1].Ajustage=true;
becanromain 6:21e96e439978 1658
becanromain 6:21e96e439978 1659 CsgDebit.Val = 50; CsgDebit.Unit = "L/min"; CsgDebit.Min = 10; CsgDebit.Max = 100; CsgDebit.Txt = "Consigne Débit"; CsgDebit.Niveau = 1;
becanromain 6:21e96e439978 1660 Volume.Val = 12345; Volume.Unit = "L";
becanromain 6:21e96e439978 1661 Debit.Val = 8; Debit.Unit = "L/min";
becanromain 6:21e96e439978 1662 DebitMoy.Val =7; DebitMoy.Unit = "L/min";
becanromain 6:21e96e439978 1663 ProgEC.Val ="AUCUN PROGRAMME EN COURS";
becanromain 6:21e96e439978 1664 Duree.Val =7; Duree.Unit = "";
becanromain 6:21e96e439978 1665 TotalisateurVol.Val =7; TotalisateurVol.Unit = "L";
becanromain 6:21e96e439978 1666 TotalisateurDuree.Val =7; TotalisateurDuree.Unit = "h";
becanromain 6:21e96e439978 1667 NPremiereMin.Val =10; NPremiereMin.Unit = "min";
becanromain 6:21e96e439978 1668 NDerniereMin.Val =10; NDerniereMin.Unit = "min";
becanromain 6:21e96e439978 1669 DebNPremiereMin.Val =8; DebNPremiereMin.Unit = "L/min";
becanromain 6:21e96e439978 1670 DebNDerniereMin.Val =8; DebNDerniereMin.Unit = "L/min";
becanromain 6:21e96e439978 1671 EcartType.Val =0.12; EcartType.Unit = "L/min";
becanromain 6:21e96e439978 1672 TensionBat.Val =3.2; TensionBat.Unit = "V";
becanromain 6:21e96e439978 1673 Intensite.Val =1; Intensite.Unit = "A";
becanromain 6:21e96e439978 1674 VitessePpe.Val =4000; VitessePpe.Unit = "tr/min";
becanromain 6:21e96e439978 1675 ConsoPrelev.Val =100; ConsoPrelev.Unit = "W";
becanromain 6:21e96e439978 1676 Puissance.Val =100; Puissance.Unit = "Wh";
becanromain 6:21e96e439978 1677 NomEquipement.Val="Mallette 1"; NomEquipement.NbCarMax = 10; NomEquipement.Txt = "Nom équipement"; NomEquipement.Niveau = 1; //Gabor
becanromain 6:21e96e439978 1678 NumSerieEquipement.Val="20AAA"; NumSerieEquipement.NbCarMax = 8; NumSerieEquipement.Txt = "Numéro série constructeur"; NumSerieEquipement.Niveau = 3;
becanromain 6:21e96e439978 1679 }
becanromain 6:21e96e439978 1680
becanromain 6:21e96e439978 1681 //////////////////
becanromain 6:21e96e439978 1682 // BANDEAU HAUT //
becanromain 6:21e96e439978 1683 //////////////////
becanromain 6:21e96e439978 1684 static void AFFBandeauHaut(int Num)
becanromain 6:21e96e439978 1685 {
becanromain 6:21e96e439978 1686 if(BandeauHaut) {
becanromain 6:21e96e439978 1687 lv_obj_del(BandeauHaut);
becanromain 6:21e96e439978 1688 BandeauHaut = NULL;
becanromain 6:21e96e439978 1689 }
becanromain 6:21e96e439978 1690 NumBandeauHaut=Num;
becanromain 6:21e96e439978 1691
becanromain 6:21e96e439978 1692 //Bandeau haut sans Menu
becanromain 6:21e96e439978 1693 if (NumBandeauHaut==1){
becanromain 6:21e96e439978 1694 // CREATION OBJET BANDEAU HAUT
becanromain 6:21e96e439978 1695 BandeauHaut = lv_cont_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 1696 lv_obj_set_size(BandeauHaut,hres,40);
becanromain 6:21e96e439978 1697 lv_obj_set_pos(BandeauHaut, 0, 0);
becanromain 6:21e96e439978 1698
becanromain 6:21e96e439978 1699 //BP APPEL MENU
becanromain 6:21e96e439978 1700 BPMENU = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1701 label = lv_label_create(BPMENU, NULL);
becanromain 6:21e96e439978 1702 lv_label_set_text(label, LV_SYMBOL_PLAY);
becanromain 6:21e96e439978 1703 lv_obj_set_size(BPMENU,40,40);
becanromain 6:21e96e439978 1704 lv_obj_set_pos(BandeauHaut, 0, 0);
becanromain 6:21e96e439978 1705 lv_obj_set_event_cb(BPMENU, BPMENU_ACT);
becanromain 6:21e96e439978 1706
becanromain 6:21e96e439978 1707 //CHEMIN PAGE
becanromain 6:21e96e439978 1708 AffChemin = lv_label_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1709 lv_obj_set_style(AffChemin, &P22);
becanromain 6:21e96e439978 1710 lv_obj_align(AffChemin, BandeauHaut, LV_ALIGN_IN_LEFT_MID, 45, 0);
becanromain 6:21e96e439978 1711 sprintf(text, Chemin); lv_label_set_text(AffChemin, text);
becanromain 6:21e96e439978 1712
becanromain 6:21e96e439978 1713 //ETAT BATTERIE
becanromain 6:21e96e439978 1714 AffSymbBat = lv_label_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1715 lv_obj_set_style(AffSymbBat, &P22);
becanromain 6:21e96e439978 1716 lv_obj_align(AffSymbBat, BandeauHaut, LV_ALIGN_IN_TOP_RIGHT, -15, 3);
becanromain 6:21e96e439978 1717 sprintf(text,LV_SYMBOL_BATTERY_3 ); lv_label_set_text(AffSymbBat, text);
becanromain 6:21e96e439978 1718 AffPourcBat = lv_label_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1719 lv_obj_set_style(AffPourcBat, &P12);
becanromain 6:21e96e439978 1720 lv_obj_align(AffPourcBat, AffSymbBat, LV_ALIGN_OUT_BOTTOM_LEFT, 0, -8);
becanromain 6:21e96e439978 1721 sprintf(text,"75%%"); lv_label_set_text(AffPourcBat, text);
becanromain 6:21e96e439978 1722
becanromain 6:21e96e439978 1723 }
becanromain 6:21e96e439978 1724
becanromain 6:21e96e439978 1725 //Bandeau haut avec Menu
becanromain 6:21e96e439978 1726 if (NumBandeauHaut==2){
becanromain 6:21e96e439978 1727 //TEMPS D'AFFICHAGE BANDEAU HAUT
becanromain 6:21e96e439978 1728 TpsAvFermMenu=5000;
becanromain 6:21e96e439978 1729
becanromain 6:21e96e439978 1730 // CREATION OBJET BANDEAU HAUT
becanromain 6:21e96e439978 1731 BandeauHaut = lv_cont_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 1732 lv_obj_set_size(BandeauHaut,2000,40);
becanromain 6:21e96e439978 1733 // lv_cont_set_fit2(BandeauHaut,LV_FIT_TIGHT, LV_FIT_NONE);
becanromain 6:21e96e439978 1734 lv_obj_set_pos(BandeauHaut, 0, 0);
becanromain 6:21e96e439978 1735 lv_obj_set_drag_dir(BandeauHaut, LV_DRAG_DIR_HOR);
becanromain 6:21e96e439978 1736 lv_obj_set_drag_throw(BandeauHaut, true);
becanromain 6:21e96e439978 1737
becanromain 6:21e96e439978 1738 //MENU 1
becanromain 6:21e96e439978 1739 M100 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1740 StyleBPM(M100);
becanromain 6:21e96e439978 1741 lv_obj_t * label = lv_label_create(M100, NULL);
becanromain 6:21e96e439978 1742 lv_label_set_text(label, _("M100"));
becanromain 6:21e96e439978 1743 lv_obj_set_size(M100,130,40);
becanromain 6:21e96e439978 1744 lv_obj_set_drag_parent(M100, true);
becanromain 6:21e96e439978 1745 lv_obj_set_event_cb(M100, M100_ACT);
becanromain 6:21e96e439978 1746
becanromain 6:21e96e439978 1747 //MENU 2
becanromain 6:21e96e439978 1748 M200 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1749 StyleBPM(M200);
becanromain 6:21e96e439978 1750 label = lv_label_create(M200, NULL);
becanromain 6:21e96e439978 1751 lv_label_set_text(label, _("M200"));
becanromain 6:21e96e439978 1752 lv_obj_set_size(M200,130,40);
becanromain 6:21e96e439978 1753 lv_obj_align(M200, M100, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1754 lv_obj_set_drag_parent(M200, true);
becanromain 6:21e96e439978 1755 lv_obj_set_event_cb(M200, M200_ACT);
becanromain 6:21e96e439978 1756
becanromain 6:21e96e439978 1757 //MENU 3
becanromain 6:21e96e439978 1758 M300 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1759 StyleBPM(M300);
becanromain 6:21e96e439978 1760 label = lv_label_create(M300, NULL);
becanromain 6:21e96e439978 1761 lv_label_set_text(label, _("M300"));
becanromain 6:21e96e439978 1762 lv_obj_set_size(M300,130,40);
becanromain 6:21e96e439978 1763 lv_obj_align(M300, M200, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1764 lv_obj_set_drag_parent(M300, true);
becanromain 6:21e96e439978 1765 lv_obj_set_event_cb(M300, M300_ACT);
becanromain 6:21e96e439978 1766
becanromain 6:21e96e439978 1767 //MENU 4
becanromain 6:21e96e439978 1768 M400 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1769 StyleBPM(M400);
becanromain 6:21e96e439978 1770 label = lv_label_create(M400, NULL);
becanromain 6:21e96e439978 1771 lv_label_set_text(label, _("M400"));
becanromain 6:21e96e439978 1772 lv_obj_set_size(M400,130,40);
becanromain 6:21e96e439978 1773 lv_obj_align(M400, M300, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1774 lv_obj_set_drag_parent(M400, true);
becanromain 6:21e96e439978 1775 lv_obj_set_event_cb(M400, M400_ACT);
becanromain 6:21e96e439978 1776
becanromain 6:21e96e439978 1777 //MENU 5
becanromain 6:21e96e439978 1778 M500 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1779 StyleBPM(M500);
becanromain 6:21e96e439978 1780 label = lv_label_create(M500, NULL);
becanromain 6:21e96e439978 1781 lv_label_set_text(label, _("M500"));
becanromain 6:21e96e439978 1782 lv_obj_set_size(M500,130,40);
becanromain 6:21e96e439978 1783 lv_obj_align(M500, M400, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1784 lv_obj_set_drag_parent(M500, true);
becanromain 6:21e96e439978 1785 lv_obj_set_event_cb(M500, M500_ACT);
becanromain 6:21e96e439978 1786
becanromain 6:21e96e439978 1787 //MENU 6
becanromain 6:21e96e439978 1788 M600 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1789 StyleBPM(M600);
becanromain 6:21e96e439978 1790 label = lv_label_create(M600, NULL);
becanromain 6:21e96e439978 1791 lv_label_set_text(label, _("M600"));
becanromain 6:21e96e439978 1792 lv_obj_set_size(M600,130,40);
becanromain 6:21e96e439978 1793 lv_obj_align(M600, M500, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1794 lv_obj_set_drag_parent(M600, true);
becanromain 6:21e96e439978 1795 lv_obj_set_event_cb(M600, M600_ACT);
becanromain 6:21e96e439978 1796
becanromain 6:21e96e439978 1797 //MENU 7
becanromain 6:21e96e439978 1798 // M700 = lv_btn_create(BandeauHaut, NULL);
becanromain 6:21e96e439978 1799 // StyleBPM(M700);
becanromain 6:21e96e439978 1800 // label = lv_label_create(M700, NULL);
becanromain 6:21e96e439978 1801 // lv_label_set_text(label, _("M700"));
becanromain 6:21e96e439978 1802 // lv_obj_set_size(M700,130,40);
becanromain 6:21e96e439978 1803 // lv_obj_align(M700, M600, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
becanromain 6:21e96e439978 1804 // lv_obj_set_drag_parent(M700, true);
becanromain 6:21e96e439978 1805 // lv_obj_set_event_cb(M700, M700_ACT);
becanromain 6:21e96e439978 1806 }
becanromain 0:cf6b1eca3e67 1807 }
becanromain 0:cf6b1eca3e67 1808
becanromain 0:cf6b1eca3e67 1809
becanromain 6:21e96e439978 1810 static void AFFSousMenu(int Num)
becanromain 6:21e96e439978 1811 {
becanromain 6:21e96e439978 1812 //SI SOUS MENU DEJA AFFICHE : SUPPRIMER PAGE AVANT CREATION NOUVELLE
becanromain 6:21e96e439978 1813 if(SousMenu) {
becanromain 6:21e96e439978 1814 lv_obj_del(SousMenu);
becanromain 6:21e96e439978 1815 SousMenu = NULL;
becanromain 6:21e96e439978 1816 }
becanromain 6:21e96e439978 1817 //Memorisation sousmenu en cours
becanromain 6:21e96e439978 1818 NumSousMenu=Num;
becanromain 6:21e96e439978 1819 /*Create a list*/
becanromain 6:21e96e439978 1820 SousMenu = lv_list_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 1821 lv_obj_set_pos(SousMenu, 0, 40);
becanromain 6:21e96e439978 1822 StyleBPSM(SousMenu);
becanromain 6:21e96e439978 1823 AnimSousMenu=48;//TAILLE FENETRE FOIS NB BOUTON
becanromain 6:21e96e439978 1824
becanromain 6:21e96e439978 1825 //SOUS MENU 100
becanromain 6:21e96e439978 1826 if (Num==100){
becanromain 6:21e96e439978 1827 AnimSousMenu=AnimSousMenu*2;//TAILLE FENETRE
becanromain 6:21e96e439978 1828 lv_obj_t * SM101 = lv_list_add_btn(SousMenu, NULL, _("M101"));
becanromain 6:21e96e439978 1829 if (UserEC.Niveau<0){lv_btn_set_state(SM101, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1830 lv_obj_set_event_cb(SM101, SM_ACT);
becanromain 6:21e96e439978 1831
becanromain 6:21e96e439978 1832 lv_obj_t * SM102 = lv_list_add_btn(SousMenu, NULL, _("M102"));
becanromain 6:21e96e439978 1833 if (UserEC.Niveau<0){lv_btn_set_state(SM102, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1834 lv_obj_set_event_cb(SM102, SM_ACT);
becanromain 6:21e96e439978 1835 }
becanromain 6:21e96e439978 1836
becanromain 6:21e96e439978 1837 //SOUS MENU 200
becanromain 6:21e96e439978 1838 if (Num==200){
becanromain 6:21e96e439978 1839 AnimSousMenu=AnimSousMenu*3;//TAILLE FENETRE
becanromain 6:21e96e439978 1840 lv_obj_t * SM201 = lv_list_add_btn(SousMenu, NULL, _("M201"));
becanromain 6:21e96e439978 1841 if (UserEC.Niveau<1){lv_btn_set_state(SM201, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1842 lv_obj_set_event_cb(SM201, SM_ACT);
becanromain 6:21e96e439978 1843
becanromain 6:21e96e439978 1844 lv_obj_t * SM202 = lv_list_add_btn(SousMenu, NULL, _("M202"));
becanromain 6:21e96e439978 1845 if (UserEC.Niveau<0){lv_btn_set_state(SM202, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1846 lv_obj_set_event_cb(SM202, SM_ACT);
becanromain 6:21e96e439978 1847
becanromain 6:21e96e439978 1848 lv_obj_t * SM203 = lv_list_add_btn(SousMenu, NULL, _("M203"));
becanromain 6:21e96e439978 1849 if (UserEC.Niveau<0){lv_btn_set_state(SM203, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1850 lv_obj_set_event_cb(SM203, SM_ACT);
becanromain 6:21e96e439978 1851 }
becanromain 6:21e96e439978 1852
becanromain 6:21e96e439978 1853 //SOUS MENU 300
becanromain 6:21e96e439978 1854 if (Num==300){
becanromain 6:21e96e439978 1855 AnimSousMenu=AnimSousMenu*9;//TAILLE FENETRE
becanromain 6:21e96e439978 1856 lv_obj_t * SM301 = lv_list_add_btn(SousMenu, NULL, _("M301"));
becanromain 6:21e96e439978 1857 if (UserEC.Niveau<1){lv_btn_set_state(SM301, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1858 lv_obj_set_event_cb(SM301, SM_ACT);
becanromain 6:21e96e439978 1859
becanromain 6:21e96e439978 1860 lv_obj_t * SM302 = lv_list_add_btn(SousMenu, NULL, _("M302"));
becanromain 6:21e96e439978 1861 if (UserEC.Niveau<0){lv_btn_set_state(SM302, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1862 lv_obj_set_event_cb(SM302, SM_ACT);
becanromain 6:21e96e439978 1863
becanromain 6:21e96e439978 1864 lv_obj_t * SM303 = lv_list_add_btn(SousMenu, NULL, _("M303"));
becanromain 6:21e96e439978 1865 if (UserEC.Niveau<0){lv_btn_set_state(SM303, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1866 lv_obj_set_event_cb(SM303, SM_ACT);
becanromain 6:21e96e439978 1867
becanromain 6:21e96e439978 1868 lv_obj_t * SM304 = lv_list_add_btn(SousMenu, NULL, _("M304"));
becanromain 6:21e96e439978 1869 if (UserEC.Niveau<0){lv_btn_set_state(SM304, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1870 lv_obj_set_event_cb(SM304, SM_ACT);
becanromain 6:21e96e439978 1871
becanromain 6:21e96e439978 1872 lv_obj_t * SM305 = lv_list_add_btn(SousMenu, NULL, _("M305"));
becanromain 6:21e96e439978 1873 if (UserEC.Niveau<0){lv_btn_set_state(SM305, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1874 lv_obj_set_event_cb(SM305, SM_ACT);
becanromain 6:21e96e439978 1875
becanromain 6:21e96e439978 1876 lv_obj_t * SM306 = lv_list_add_btn(SousMenu, NULL, _("M306"));
becanromain 6:21e96e439978 1877 if (UserEC.Niveau<0){lv_btn_set_state(SM306, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1878 lv_obj_set_event_cb(SM306, SM_ACT);
becanromain 6:21e96e439978 1879
becanromain 6:21e96e439978 1880 lv_obj_t * SM307 = lv_list_add_btn(SousMenu, NULL, _("M307"));
becanromain 6:21e96e439978 1881 if (UserEC.Niveau<0){lv_btn_set_state(SM307, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1882 lv_obj_set_event_cb(SM307, SM_ACT);
becanromain 6:21e96e439978 1883
becanromain 6:21e96e439978 1884 lv_obj_t * SM308 = lv_list_add_btn(SousMenu, NULL, _("M308"));
becanromain 6:21e96e439978 1885 if (UserEC.Niveau<0){lv_btn_set_state(SM308, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1886 lv_obj_set_event_cb(SM308, SM_ACT);
becanromain 6:21e96e439978 1887
becanromain 6:21e96e439978 1888 lv_obj_t * SM309 = lv_list_add_btn(SousMenu, NULL, _("M309"));
becanromain 6:21e96e439978 1889 if (UserEC.Niveau<0){lv_btn_set_state(SM309, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1890 lv_obj_set_event_cb(SM309, SM_ACT);
becanromain 6:21e96e439978 1891 }
becanromain 6:21e96e439978 1892
becanromain 6:21e96e439978 1893 //SOUS MENU 400
becanromain 6:21e96e439978 1894 if (Num==400){
becanromain 6:21e96e439978 1895 AnimSousMenu=AnimSousMenu*5;//TAILLE FENETRE
becanromain 6:21e96e439978 1896 lv_obj_t * SM401 = lv_list_add_btn(SousMenu, NULL, _("M401"));
becanromain 6:21e96e439978 1897 if (UserEC.Niveau<1){lv_btn_set_state(SM401, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1898 lv_obj_set_event_cb(SM401, SM_ACT);
becanromain 6:21e96e439978 1899
becanromain 6:21e96e439978 1900 lv_obj_t * SM402 = lv_list_add_btn(SousMenu, NULL, _("M402"));
becanromain 6:21e96e439978 1901 if (UserEC.Niveau<0){lv_btn_set_state(SM402, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1902 lv_obj_set_event_cb(SM402, SM_ACT);
becanromain 6:21e96e439978 1903
becanromain 6:21e96e439978 1904 lv_obj_t * SM403 = lv_list_add_btn(SousMenu, NULL, _("M403"));
becanromain 6:21e96e439978 1905 if (UserEC.Niveau<0){lv_btn_set_state(SM403, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1906 lv_obj_set_event_cb(SM403, SM_ACT);
becanromain 6:21e96e439978 1907
becanromain 6:21e96e439978 1908 lv_obj_t * SM404 = lv_list_add_btn(SousMenu, NULL, _("M404"));
becanromain 6:21e96e439978 1909 if (UserEC.Niveau<0){lv_btn_set_state(SM404, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1910 lv_obj_set_event_cb(SM404, SM_ACT);
becanromain 6:21e96e439978 1911
becanromain 6:21e96e439978 1912 lv_obj_t * SM405 = lv_list_add_btn(SousMenu, NULL, _("M405"));
becanromain 6:21e96e439978 1913 if (UserEC.Niveau<0){lv_btn_set_state(SM405, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1914 lv_obj_set_event_cb(SM405, SM_ACT);
becanromain 6:21e96e439978 1915 }
becanromain 6:21e96e439978 1916
becanromain 6:21e96e439978 1917 //SOUS MENU 500
becanromain 6:21e96e439978 1918 if (Num==500){
becanromain 6:21e96e439978 1919 AnimSousMenu=AnimSousMenu*3;//TAILLE FENETRE
becanromain 6:21e96e439978 1920 lv_obj_t * SM501 = lv_list_add_btn(SousMenu, NULL, _("M501"));
becanromain 6:21e96e439978 1921 if (UserEC.Niveau<1){lv_btn_set_state(SM501, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1922 lv_obj_set_event_cb(SM501, SM_ACT);
becanromain 6:21e96e439978 1923
becanromain 6:21e96e439978 1924 lv_obj_t * SM502 = lv_list_add_btn(SousMenu, NULL, _("M502"));
becanromain 6:21e96e439978 1925 if (UserEC.Niveau<0){lv_btn_set_state(SM502, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1926 lv_obj_set_event_cb(SM502, SM_ACT);
becanromain 6:21e96e439978 1927
becanromain 6:21e96e439978 1928 lv_obj_t * SM503 = lv_list_add_btn(SousMenu, NULL, _("M503"));
becanromain 6:21e96e439978 1929 if (UserEC.Niveau<0){lv_btn_set_state(SM503, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1930 lv_obj_set_event_cb(SM503, SM_ACT);
becanromain 6:21e96e439978 1931 }
becanromain 6:21e96e439978 1932
becanromain 6:21e96e439978 1933 //SOUS MENU 600
becanromain 6:21e96e439978 1934 if (Num==600){
becanromain 6:21e96e439978 1935 AnimSousMenu=AnimSousMenu*1;//TAILLE FENETRE
becanromain 6:21e96e439978 1936 lv_obj_t * SM601 = lv_list_add_btn(SousMenu, NULL, _("M601"));
becanromain 6:21e96e439978 1937 if (UserEC.Niveau<1){lv_btn_set_state(SM601, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1938 lv_obj_set_event_cb(SM601, SM_ACT);
becanromain 6:21e96e439978 1939 }
becanromain 6:21e96e439978 1940
becanromain 6:21e96e439978 1941 //SOUS MENU 700
becanromain 6:21e96e439978 1942 // if (Num==700){
becanromain 6:21e96e439978 1943 // AnimSousMenu=AnimSousMenu*1;//TAILLE FENETRE
becanromain 6:21e96e439978 1944 // lv_obj_t * SM701 = lv_list_add_btn(SousMenu, NULL, _("M701"));
becanromain 6:21e96e439978 1945 // if (UserEC.Niveau<1){lv_btn_set_state(SM701, LV_BTN_STATE_INA );}
becanromain 6:21e96e439978 1946 // lv_obj_set_event_cb(SM701, SM_ACT);
becanromain 6:21e96e439978 1947 // }
becanromain 6:21e96e439978 1948 if (AnimSousMenu>232){AnimSousMenu=232;}//TAILLE FENETRE MAXI 232=272-40
becanromain 6:21e96e439978 1949 }
becanromain 0:cf6b1eca3e67 1950
becanromain 0:cf6b1eca3e67 1951
becanromain 0:cf6b1eca3e67 1952 //********************
becanromain 0:cf6b1eca3e67 1953 // POPUP CONNEXION MDP
becanromain 0:cf6b1eca3e67 1954 //********************
becanromain 0:cf6b1eca3e67 1955 static void AFFPopupMDP(){
becanromain 0:cf6b1eca3e67 1956 //FOND GRISE
becanromain 0:cf6b1eca3e67 1957 static lv_style_t modal_style;
becanromain 0:cf6b1eca3e67 1958 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 0:cf6b1eca3e67 1959 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 0:cf6b1eca3e67 1960 modal_style.body.opa = LV_OPA_50;
becanromain 0:cf6b1eca3e67 1961 FondGris = lv_obj_create(lv_scr_act(), NULL);
becanromain 0:cf6b1eca3e67 1962 lv_obj_set_style(FondGris, &modal_style);
becanromain 0:cf6b1eca3e67 1963 lv_obj_set_pos(FondGris, 0, 0);
becanromain 0:cf6b1eca3e67 1964 lv_obj_set_size(FondGris, LV_HOR_RES, LV_VER_RES);
becanromain 0:cf6b1eca3e67 1965 lv_obj_set_opa_scale_enable(FondGris, true);
becanromain 0:cf6b1eca3e67 1966
becanromain 6:21e96e439978 1967 //CREATION POPUP CONNEXION MDP
becanromain 0:cf6b1eca3e67 1968 PopupMDP = lv_obj_create(FondGris, NULL);
becanromain 0:cf6b1eca3e67 1969 lv_obj_set_size(PopupMDP,400,260);
becanromain 0:cf6b1eca3e67 1970 lv_obj_align(PopupMDP, FondGris, LV_ALIGN_CENTER, 0, 0);
becanromain 0:cf6b1eca3e67 1971 lv_obj_set_opa_scale_enable(PopupMDP, true);
becanromain 0:cf6b1eca3e67 1972 lv_obj_set_opa_scale(PopupMDP, 240);
becanromain 0:cf6b1eca3e67 1973
becanromain 0:cf6b1eca3e67 1974 //TITRE
becanromain 6:21e96e439978 1975 label = lv_label_create(PopupMDP, NULL);
becanromain 6:21e96e439978 1976 lv_obj_set_style(label,&PG12);
becanromain 6:21e96e439978 1977 lv_label_set_text(label, _("NIVEAU D'ACCES INSSUFISANT POUR REALISER CETTE ACTION\nVEUILLEZ VOUS IDENTIFER:"));
becanromain 0:cf6b1eca3e67 1978 lv_obj_align(label, PopupMDP, LV_ALIGN_IN_TOP_MID, 0, 3);
becanromain 0:cf6b1eca3e67 1979 lv_obj_set_opa_scale_enable(label, true);
becanromain 0:cf6b1eca3e67 1980 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 0:cf6b1eca3e67 1981
becanromain 0:cf6b1eca3e67 1982 //CREATION LISTE UTILISATEUR POUR AFFICHAGE
becanromain 4:6a3d12663549 1983 //G/ABOR: Mabye you have a better solution than:
kisvegabor 1:404ee28a0b60 1984 //ROMAIN: There is no much better way, but I have a few comments
becanromain 0:cf6b1eca3e67 1985 int i;
becanromain 0:cf6b1eca3e67 1986 int j;
becanromain 0:cf6b1eca3e67 1987 int k=0;
becanromain 0:cf6b1eca3e67 1988 char p[2200];
kisvegabor 1:404ee28a0b60 1989
kisvegabor 1:404ee28a0b60 1990 //ROMAIN:
kisvegabor 1:404ee28a0b60 1991 // - p[i]=='\0'; it should be p[i]='\0'; isn't it?
kisvegabor 1:404ee28a0b60 1992 // - If so why not start from i = 0 to initalize?
kisvegabor 1:404ee28a0b60 1993 // - memset(p, '\0', sizeof(p)) can be a clearer option to initialize
kisvegabor 1:404ee28a0b60 1994 for (i = 1; i < 2200; i++) { p[i]=='\0';}
kisvegabor 1:404ee28a0b60 1995
kisvegabor 1:404ee28a0b60 1996 for (i = 1; i < 100; i++) { //ROMAIN: Why start from 1?
becanromain 0:cf6b1eca3e67 1997 string s=User[i].Nom;
becanromain 0:cf6b1eca3e67 1998 if (s.length()>0){
kisvegabor 1:404ee28a0b60 1999 //ROMAIN: I suggest using memcpy instead
kisvegabor 1:404ee28a0b60 2000 // memcpy(&p[k], s, s.length())
kisvegabor 1:404ee28a0b60 2001 // k += s.length();
kisvegabor 1:404ee28a0b60 2002 // p[k] = '\n';
kisvegabor 1:404ee28a0b60 2003 // k++;
becanromain 0:cf6b1eca3e67 2004 for (j = 0; j < s.length(); j++) {
becanromain 0:cf6b1eca3e67 2005 p[k] = s[j];
becanromain 0:cf6b1eca3e67 2006 k++;
becanromain 0:cf6b1eca3e67 2007 }
becanromain 0:cf6b1eca3e67 2008 p[k]='\n';
becanromain 0:cf6b1eca3e67 2009 k++;
becanromain 0:cf6b1eca3e67 2010 }
becanromain 0:cf6b1eca3e67 2011 }
kisvegabor 1:404ee28a0b60 2012 //ROMAIN:
kisvegabor 1:404ee28a0b60 2013 // - you alraedy incremented k, so it should p[k] = '\0', shouldn't it?
kisvegabor 1:404ee28a0b60 2014 // - and you initialized p to '\0' so it's not required
becanromain 0:cf6b1eca3e67 2015 p[k+1]='\0';
becanromain 0:cf6b1eca3e67 2016 char * ListeUser= p ;
becanromain 0:cf6b1eca3e67 2017
becanromain 0:cf6b1eca3e67 2018 //SELECTEUR UTILISATEUR
becanromain 0:cf6b1eca3e67 2019 SelectID = lv_roller_create(PopupMDP, NULL);
becanromain 0:cf6b1eca3e67 2020 lv_roller_set_options(SelectID,ListeUser,LV_ROLLER_MODE_NORMAL);
becanromain 0:cf6b1eca3e67 2021 lv_roller_set_visible_row_count(SelectID, 9);
becanromain 6:21e96e439978 2022 lv_roller_set_fix_width(SelectID, 175);
becanromain 6:21e96e439978 2023 lv_obj_align(SelectID, PopupMDP, LV_ALIGN_IN_TOP_LEFT, 10, 40);
becanromain 0:cf6b1eca3e67 2024
becanromain 0:cf6b1eca3e67 2025 //CHAMPS MOT DE PASSE
becanromain 0:cf6b1eca3e67 2026 MDP = lv_ta_create(PopupMDP, NULL);
becanromain 0:cf6b1eca3e67 2027 lv_ta_set_text(MDP, "");
becanromain 0:cf6b1eca3e67 2028 lv_ta_set_pwd_mode(MDP, true);
becanromain 0:cf6b1eca3e67 2029 lv_ta_set_one_line(MDP, true);
becanromain 6:21e96e439978 2030 lv_obj_set_width(MDP, 175);
becanromain 6:21e96e439978 2031 lv_obj_align(MDP, PopupMDP, LV_ALIGN_IN_TOP_RIGHT, -10, 40);
becanromain 0:cf6b1eca3e67 2032 lv_obj_set_opa_scale_enable(MDP, true);
becanromain 0:cf6b1eca3e67 2033 lv_obj_set_opa_scale(MDP, LV_OPA_COVER);
becanromain 0:cf6b1eca3e67 2034 lv_ta_set_max_length(MDP, 4);
becanromain 0:cf6b1eca3e67 2035
becanromain 0:cf6b1eca3e67 2036 // PAVE NUMERIQUE SAISIE MOT DE PASSE
becanromain 0:cf6b1eca3e67 2037 static lv_style_t rel_style, pr_style; //STYLE CLAVIER
becanromain 0:cf6b1eca3e67 2038 lv_style_copy(&rel_style, &lv_style_btn_rel);
becanromain 0:cf6b1eca3e67 2039 rel_style.body.radius = 0;
becanromain 0:cf6b1eca3e67 2040 rel_style.body.border.width = 1;
becanromain 0:cf6b1eca3e67 2041 lv_style_copy(&pr_style, &lv_style_btn_pr);
becanromain 0:cf6b1eca3e67 2042 pr_style.body.radius = 0;
becanromain 0:cf6b1eca3e67 2043 pr_style.body.border.width = 1;
becanromain 0:cf6b1eca3e67 2044
becanromain 6:21e96e439978 2045 kb = lv_kb_create(PopupMDP, NULL);
becanromain 6:21e96e439978 2046 lv_kb_set_mode(kb, LV_KB_MODE_NUM );
becanromain 6:21e96e439978 2047 lv_obj_set_event_cb(kb, kb_MDP_ACT);
becanromain 6:21e96e439978 2048 lv_kb_set_ta(kb, MDP);
becanromain 6:21e96e439978 2049 lv_obj_set_size(kb,175,175);
becanromain 6:21e96e439978 2050 lv_btnm_set_map(kb, PAVE_MDP_MAP);
becanromain 6:21e96e439978 2051 lv_obj_align(kb, MDP, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 2052 lv_obj_set_opa_scale_enable(kb, true);
becanromain 6:21e96e439978 2053 lv_obj_set_opa_scale(kb, LV_OPA_COVER);
becanromain 6:21e96e439978 2054 lv_kb_set_cursor_manage(kb, true);
becanromain 6:21e96e439978 2055 lv_kb_set_style(kb, LV_KB_STYLE_BG, &lv_style_transp_tight);
becanromain 6:21e96e439978 2056 lv_kb_set_style(kb, LV_KB_STYLE_BTN_REL, &rel_style);
becanromain 6:21e96e439978 2057 lv_kb_set_style(kb, LV_KB_STYLE_BTN_PR, &pr_style);
becanromain 6:21e96e439978 2058 lv_ta_set_text(MDP, "");
becanromain 0:cf6b1eca3e67 2059
becanromain 0:cf6b1eca3e67 2060
becanromain 0:cf6b1eca3e67 2061 }
becanromain 6:21e96e439978 2062 static void kb_MDP_ACT(lv_obj_t * event_kb, lv_event_t event)
becanromain 6:21e96e439978 2063 {
becanromain 6:21e96e439978 2064 lv_kb_def_event_cb(event_kb, event);
becanromain 6:21e96e439978 2065 if(event == LV_EVENT_APPLY ) {
becanromain 6:21e96e439978 2066 //RECUPERATION DU NOM DE L'UTILISATEUR SELECTIONNE
becanromain 0:cf6b1eca3e67 2067 char NomSelect[20];
becanromain 0:cf6b1eca3e67 2068 lv_roller_get_selected_str(SelectID, NomSelect, sizeof(NomSelect));
becanromain 0:cf6b1eca3e67 2069
becanromain 0:cf6b1eca3e67 2070 //RECUPERATION MOT DE PASSE SAISIE
becanromain 0:cf6b1eca3e67 2071 string MdpSaisie;
becanromain 0:cf6b1eca3e67 2072 MdpSaisie = lv_ta_get_text(MDP);
becanromain 0:cf6b1eca3e67 2073
becanromain 0:cf6b1eca3e67 2074 //FOND GRISE
becanromain 0:cf6b1eca3e67 2075 static lv_style_t modal_style;
becanromain 0:cf6b1eca3e67 2076 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 0:cf6b1eca3e67 2077 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 0:cf6b1eca3e67 2078 modal_style.body.opa = LV_OPA_50;
becanromain 0:cf6b1eca3e67 2079 FondGris2 = lv_obj_create(lv_scr_act(), NULL);
becanromain 0:cf6b1eca3e67 2080 lv_obj_set_style(FondGris2, &modal_style);
becanromain 0:cf6b1eca3e67 2081 lv_obj_set_pos(FondGris2, 0, 0);
becanromain 0:cf6b1eca3e67 2082 lv_obj_set_size(FondGris2, LV_HOR_RES, LV_VER_RES);
becanromain 0:cf6b1eca3e67 2083 lv_obj_set_opa_scale_enable(FondGris2, true);
becanromain 0:cf6b1eca3e67 2084 //COMPARAISON AVEC LISTE
becanromain 0:cf6b1eca3e67 2085 static const char * btns2[] = {"Ok", ""};
becanromain 0:cf6b1eca3e67 2086 for (int i = 1; i < 100; i++) {
becanromain 0:cf6b1eca3e67 2087 if (User[i].Nom==NomSelect)
becanromain 0:cf6b1eca3e67 2088 if (User[i].MDP==MdpSaisie){
becanromain 0:cf6b1eca3e67 2089 mbox=lv_mbox_create(FondGris2, NULL);
becanromain 0:cf6b1eca3e67 2090 lv_mbox_add_btns(mbox, btns2);
becanromain 0:cf6b1eca3e67 2091 if (User[i].Niveau==1){sprintf(text2, "qu'operateur" );}
becanromain 0:cf6b1eca3e67 2092 if (User[i].Niveau==2){sprintf(text2, "que superviseur");}
becanromain 0:cf6b1eca3e67 2093 if (User[i].Niveau==3){sprintf(text2, "que constructeur");}
becanromain 0:cf6b1eca3e67 2094 sprintf(text, "Connexion autorisee a %s en tant %s pour une duree de %d min",User[i].Nom ,text2,User[i].Tps );
becanromain 0:cf6b1eca3e67 2095 lv_mbox_set_text(mbox, text);
becanromain 0:cf6b1eca3e67 2096 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 0:cf6b1eca3e67 2097 lv_obj_set_event_cb(mbox, mboxMdp_ACT);
becanromain 0:cf6b1eca3e67 2098 TpsMdpEnCours=User[i].Tps*60;
becanromain 0:cf6b1eca3e67 2099 UserEC=User[i];
becanromain 0:cf6b1eca3e67 2100 //RECLASSEMENT DU TABLEAU DES UTILISATEURS POUR AVOIR LE DERNIER CONNECTé EN PREMIER
becanromain 0:cf6b1eca3e67 2101 User[0]=User[i];
becanromain 0:cf6b1eca3e67 2102 for (int j = i; j >0; j--) { //DECALAGE TABLEAU
becanromain 0:cf6b1eca3e67 2103 User[j]=User[j-1];
becanromain 0:cf6b1eca3e67 2104 }
becanromain 0:cf6b1eca3e67 2105 return;
becanromain 0:cf6b1eca3e67 2106 }
becanromain 0:cf6b1eca3e67 2107 }
becanromain 0:cf6b1eca3e67 2108 mbox=lv_mbox_create(FondGris2, NULL);
becanromain 0:cf6b1eca3e67 2109 lv_mbox_add_btns(mbox, btns2);
becanromain 0:cf6b1eca3e67 2110 lv_mbox_set_text(mbox, "MOT DE PASSE ERRONE");
becanromain 0:cf6b1eca3e67 2111 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2112 lv_obj_set_event_cb(mbox, mboxMdp_ACT2);
becanromain 0:cf6b1eca3e67 2113 }
becanromain 6:21e96e439978 2114 if(event == LV_EVENT_CANCEL ) {
becanromain 6:21e96e439978 2115 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2116 PopupMDP=NULL;
becanromain 6:21e96e439978 2117 }
becanromain 0:cf6b1eca3e67 2118 }
becanromain 6:21e96e439978 2119 static void mboxMdp_ACT(lv_obj_t * obj, lv_event_t event)
becanromain 6:21e96e439978 2120 {
becanromain 6:21e96e439978 2121 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2122 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2123 lv_obj_del_async(FondGris2);
becanromain 6:21e96e439978 2124 PopupMDP=NULL;
becanromain 6:21e96e439978 2125 if(BandeauHaut){AFFBandeauHaut(NumBandeauHaut);}
becanromain 6:21e96e439978 2126 if(SousMenu){AFFSousMenu(NumSousMenu);}
becanromain 6:21e96e439978 2127 }
becanromain 6:21e96e439978 2128 }
becanromain 6:21e96e439978 2129 static void mboxMdp_ACT2(lv_obj_t * obj, lv_event_t event)
becanromain 0:cf6b1eca3e67 2130 {
becanromain 0:cf6b1eca3e67 2131 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2132 lv_obj_del_async(FondGris2);
becanromain 6:21e96e439978 2133 lv_ta_set_text(MDP, "");
becanromain 0:cf6b1eca3e67 2134 }
becanromain 0:cf6b1eca3e67 2135 }
becanromain 0:cf6b1eca3e67 2136
becanromain 6:21e96e439978 2137
becanromain 6:21e96e439978 2138 //********************
becanromain 6:21e96e439978 2139 // SAISIE FLOAT
becanromain 6:21e96e439978 2140 //********************
becanromain 6:21e96e439978 2141 static void DdeSaisieFloat(lv_obj_t * label, lv_event_t event)
becanromain 6:21e96e439978 2142 {
becanromain 6:21e96e439978 2143 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2144 SaisieFloat = (Float_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2145 if (UserEC.Niveau<SaisieFloat->Niveau){
becanromain 6:21e96e439978 2146 AFFPopupMDP();
becanromain 6:21e96e439978 2147 }
becanromain 6:21e96e439978 2148 else{
becanromain 6:21e96e439978 2149 PageSaisieFloat(label);
becanromain 6:21e96e439978 2150 }
becanromain 6:21e96e439978 2151 }
becanromain 6:21e96e439978 2152 }
becanromain 6:21e96e439978 2153 static void PageSaisieFloat(lv_obj_t * label){
becanromain 6:21e96e439978 2154
becanromain 6:21e96e439978 2155 //STRUCTURE SAISIE
becanromain 6:21e96e439978 2156 SaisieFloat = (Float_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2157
becanromain 6:21e96e439978 2158 //FOND GRISE
becanromain 6:21e96e439978 2159 static lv_style_t modal_style;
becanromain 6:21e96e439978 2160 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2161 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2162 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2163 FondGris = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2164 lv_obj_set_style(FondGris, &modal_style);
becanromain 6:21e96e439978 2165 lv_obj_set_pos(FondGris, 0, 0);
becanromain 6:21e96e439978 2166 lv_obj_set_size(FondGris, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2167 lv_obj_set_opa_scale_enable(FondGris, true);
becanromain 0:cf6b1eca3e67 2168
becanromain 6:21e96e439978 2169 //CREATION POPUP
becanromain 6:21e96e439978 2170 lv_obj_t *PopupNum = lv_obj_create(FondGris, NULL);
becanromain 6:21e96e439978 2171 lv_obj_set_size(PopupNum,400,260);
becanromain 6:21e96e439978 2172 lv_obj_align(PopupNum, FondGris, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2173 lv_obj_set_opa_scale_enable(PopupNum, true);
becanromain 6:21e96e439978 2174 lv_obj_set_opa_scale(PopupNum, 240);
becanromain 6:21e96e439978 2175
becanromain 6:21e96e439978 2176 //TITRE
becanromain 6:21e96e439978 2177 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2178 lv_obj_set_style(label,&PG16);
becanromain 6:21e96e439978 2179 sprintf(text, "%s", SaisieFloat->Txt);
becanromain 6:21e96e439978 2180 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2181 lv_obj_align(label, PopupNum, LV_ALIGN_IN_TOP_MID, 0, 3);
becanromain 6:21e96e439978 2182 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2183 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2184
becanromain 6:21e96e439978 2185 //CHAMPS SAISI
becanromain 6:21e96e439978 2186 ChSaisi = lv_ta_create(PopupNum, NULL);
becanromain 6:21e96e439978 2187 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2188 lv_ta_set_one_line(ChSaisi, true);
becanromain 6:21e96e439978 2189 lv_obj_set_width(ChSaisi, 200);
becanromain 6:21e96e439978 2190 lv_obj_align(ChSaisi, PopupNum, LV_ALIGN_IN_TOP_LEFT, 20, 25);
becanromain 6:21e96e439978 2191 lv_obj_set_opa_scale_enable(ChSaisi, true);
becanromain 6:21e96e439978 2192 lv_obj_set_opa_scale(ChSaisi, LV_OPA_COVER);
becanromain 6:21e96e439978 2193
becanromain 6:21e96e439978 2194 //VALEUR EN COURS / mini /maxi
becanromain 6:21e96e439978 2195 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2196 lv_obj_set_style(label,&P12);
becanromain 6:21e96e439978 2197 sprintf(text, _("Valeur Actuelle = %2.2f %s\nValeur mini = %2.2f %s\nValeur maxi = %2.2f %s\n"), SaisieFloat->Val, SaisieFloat->Unit, SaisieFloat->Min, SaisieFloat->Unit, SaisieFloat->Max, SaisieFloat->Unit);
becanromain 6:21e96e439978 2198 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2199 lv_obj_align(label, ChSaisi, LV_ALIGN_OUT_RIGHT_MID,5, 30);
becanromain 6:21e96e439978 2200 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2201 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2202
becanromain 6:21e96e439978 2203 // PAVE NUMERIQUE SAISIE
becanromain 6:21e96e439978 2204 static lv_style_t rel_style, pr_style; //STYLE CLAVIER
becanromain 6:21e96e439978 2205 lv_style_copy(&rel_style, &lv_style_btn_rel);
becanromain 6:21e96e439978 2206 rel_style.body.radius = 0;
becanromain 6:21e96e439978 2207 rel_style.body.border.width = 1;
becanromain 6:21e96e439978 2208 lv_style_copy(&pr_style, &lv_style_btn_pr);
becanromain 6:21e96e439978 2209 pr_style.body.radius = 0;
becanromain 6:21e96e439978 2210 pr_style.body.border.width = 1;
becanromain 0:cf6b1eca3e67 2211
becanromain 6:21e96e439978 2212 kb = lv_kb_create(PopupNum, NULL);
becanromain 6:21e96e439978 2213 lv_kb_set_mode(kb, LV_KB_MODE_NUM );
becanromain 6:21e96e439978 2214 lv_obj_set_event_cb(kb, KbSaisieFloat_ACT);
becanromain 6:21e96e439978 2215 lv_kb_set_ta(kb, ChSaisi);
becanromain 6:21e96e439978 2216 lv_obj_set_size(kb,200,180);
becanromain 6:21e96e439978 2217 // lv_btnm_set_map(kb, PAVE_NUMERIQUE_MAP);
becanromain 6:21e96e439978 2218 lv_obj_align(kb, ChSaisi, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 2219 lv_obj_set_opa_scale_enable(kb, true);
becanromain 6:21e96e439978 2220 lv_obj_set_opa_scale(kb, LV_OPA_COVER);
becanromain 6:21e96e439978 2221 lv_kb_set_cursor_manage(kb, true);
becanromain 6:21e96e439978 2222 lv_kb_set_style(kb, LV_KB_STYLE_BG, &lv_style_transp_tight);
becanromain 6:21e96e439978 2223 lv_kb_set_style(kb, LV_KB_STYLE_BTN_REL, &rel_style);
becanromain 6:21e96e439978 2224 lv_kb_set_style(kb, LV_KB_STYLE_BTN_PR, &pr_style);
becanromain 6:21e96e439978 2225 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2226
becanromain 6:21e96e439978 2227 }
becanromain 6:21e96e439978 2228
becanromain 6:21e96e439978 2229 static void KbSaisieFloat_ACT(lv_obj_t * event_kb, lv_event_t event)
becanromain 6:21e96e439978 2230 {
becanromain 6:21e96e439978 2231 lv_kb_def_event_cb(event_kb, event);
becanromain 6:21e96e439978 2232 if(event == LV_EVENT_APPLY ) {
becanromain 6:21e96e439978 2233 //CONVERSION VALEUR SAISIE
becanromain 6:21e96e439978 2234 const char * tmp = lv_ta_get_text(ChSaisi);
becanromain 6:21e96e439978 2235 float ValSaisie=strtof(tmp, NULL);
becanromain 6:21e96e439978 2236 //VALEUR OK
becanromain 6:21e96e439978 2237 if (ValSaisie>=SaisieFloat->Min and ValSaisie<=SaisieFloat->Max){
becanromain 6:21e96e439978 2238 SaisieFloat->Val=ValSaisie;
becanromain 6:21e96e439978 2239 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2240 }
becanromain 6:21e96e439978 2241 else{
becanromain 6:21e96e439978 2242 //VALEUR HORS LIMITES
becanromain 6:21e96e439978 2243 //MESSAGE BOX SUR FOND GRISE
becanromain 6:21e96e439978 2244 static lv_style_t modal_style;
becanromain 6:21e96e439978 2245 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2246 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2247 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2248 FondGris2 = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2249 lv_obj_set_style(FondGris2, &modal_style);
becanromain 6:21e96e439978 2250 lv_obj_set_pos(FondGris2, 0, 0);
becanromain 6:21e96e439978 2251 lv_obj_set_size(FondGris2, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2252 lv_obj_set_opa_scale_enable(FondGris2, true);
becanromain 6:21e96e439978 2253 static const char * btns2[] = {"Ok", ""};
becanromain 6:21e96e439978 2254 mbox=lv_mbox_create(FondGris2, NULL);
becanromain 6:21e96e439978 2255 lv_mbox_add_btns(mbox, btns2);
becanromain 6:21e96e439978 2256 lv_mbox_set_text(mbox, "VALEUR SAISIE HORS LIMITES");
becanromain 6:21e96e439978 2257 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2258 lv_obj_set_event_cb(mbox, mbox_ACT);
becanromain 6:21e96e439978 2259 }
becanromain 6:21e96e439978 2260 }
becanromain 6:21e96e439978 2261 if(event == LV_EVENT_CANCEL ) {
becanromain 6:21e96e439978 2262 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2263 }
becanromain 0:cf6b1eca3e67 2264 }
becanromain 6:21e96e439978 2265
becanromain 6:21e96e439978 2266 //********************
becanromain 6:21e96e439978 2267 // SAISIE INT
becanromain 6:21e96e439978 2268 //********************
becanromain 6:21e96e439978 2269 static void DdeSaisieInt(lv_obj_t * label, lv_event_t event)
becanromain 0:cf6b1eca3e67 2270 {
becanromain 6:21e96e439978 2271 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2272 SaisieFloat = (Float_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2273 if (UserEC.Niveau<SaisieInt->Niveau){
becanromain 6:21e96e439978 2274 AFFPopupMDP();
becanromain 6:21e96e439978 2275 }
becanromain 6:21e96e439978 2276 else{
becanromain 6:21e96e439978 2277 PageSaisieInt(label);
becanromain 6:21e96e439978 2278 }
becanromain 6:21e96e439978 2279 }
becanromain 6:21e96e439978 2280 }
becanromain 6:21e96e439978 2281 static void PageSaisieInt(lv_obj_t * label)
becanromain 6:21e96e439978 2282 {
becanromain 6:21e96e439978 2283 //STRUCTURE SAISIE
becanromain 6:21e96e439978 2284 SaisieInt = (Int_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2285
becanromain 6:21e96e439978 2286 //FOND GRISE
becanromain 6:21e96e439978 2287 static lv_style_t modal_style;
becanromain 6:21e96e439978 2288 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2289 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2290 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2291 FondGris = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2292 lv_obj_set_style(FondGris, &modal_style);
becanromain 6:21e96e439978 2293 lv_obj_set_pos(FondGris, 0, 0);
becanromain 6:21e96e439978 2294 lv_obj_set_size(FondGris, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2295 lv_obj_set_opa_scale_enable(FondGris, true);
becanromain 6:21e96e439978 2296
becanromain 6:21e96e439978 2297 //CREATION POPUP
becanromain 6:21e96e439978 2298 lv_obj_t *PopupNum = lv_obj_create(FondGris, NULL);
becanromain 6:21e96e439978 2299 lv_obj_set_size(PopupNum,400,260);
becanromain 6:21e96e439978 2300 lv_obj_align(PopupNum, FondGris, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2301 lv_obj_set_opa_scale_enable(PopupNum, true);
becanromain 6:21e96e439978 2302 lv_obj_set_opa_scale(PopupNum, 240);
becanromain 6:21e96e439978 2303
becanromain 6:21e96e439978 2304 //TITRE
becanromain 6:21e96e439978 2305 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2306 lv_obj_set_style(label,&PG16);
becanromain 6:21e96e439978 2307 sprintf(text, "%s", SaisieInt->Txt);
becanromain 6:21e96e439978 2308 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2309 lv_obj_align(label, PopupNum, LV_ALIGN_IN_TOP_MID, 0, 3);
becanromain 6:21e96e439978 2310 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2311 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2312
becanromain 6:21e96e439978 2313 //CHAMPS SAISI
becanromain 6:21e96e439978 2314 ChSaisi = lv_ta_create(PopupNum, NULL);
becanromain 6:21e96e439978 2315 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2316 lv_ta_set_one_line(ChSaisi, true);
becanromain 6:21e96e439978 2317 lv_obj_set_width(ChSaisi, 200);
becanromain 6:21e96e439978 2318 lv_obj_align(ChSaisi, PopupNum, LV_ALIGN_IN_TOP_LEFT, 20, 25);
becanromain 6:21e96e439978 2319 lv_obj_set_opa_scale_enable(ChSaisi, true);
becanromain 6:21e96e439978 2320 lv_obj_set_opa_scale(ChSaisi, LV_OPA_COVER);
becanromain 6:21e96e439978 2321
becanromain 6:21e96e439978 2322 //VALEUR EN COURS / mini /maxi
becanromain 6:21e96e439978 2323 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2324 lv_obj_set_style(label,&P12);
becanromain 6:21e96e439978 2325 sprintf(text, _("Valeur Actuelle = %d %s\nValeur mini = %d %s\nValeur maxi = %d %s\n"), SaisieInt->Val, SaisieInt->Unit, SaisieInt->Min, SaisieInt->Unit, SaisieInt->Max, SaisieInt->Unit);
becanromain 6:21e96e439978 2326 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2327 lv_obj_align(label, ChSaisi, LV_ALIGN_OUT_RIGHT_MID,5, 30);
becanromain 6:21e96e439978 2328 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2329 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2330
becanromain 6:21e96e439978 2331 // PAVE NUMERIQUE SAISIE
becanromain 6:21e96e439978 2332 static lv_style_t rel_style, pr_style; //STYLE CLAVIER
becanromain 6:21e96e439978 2333 lv_style_copy(&rel_style, &lv_style_btn_rel);
becanromain 6:21e96e439978 2334 rel_style.body.radius = 0;
becanromain 6:21e96e439978 2335 rel_style.body.border.width = 1;
becanromain 6:21e96e439978 2336 lv_style_copy(&pr_style, &lv_style_btn_pr);
becanromain 6:21e96e439978 2337 pr_style.body.radius = 0;
becanromain 6:21e96e439978 2338 pr_style.body.border.width = 1;
becanromain 6:21e96e439978 2339
becanromain 6:21e96e439978 2340 kb = lv_kb_create(PopupNum, NULL);
becanromain 6:21e96e439978 2341 lv_kb_set_mode(kb, LV_KB_MODE_NUM );
becanromain 6:21e96e439978 2342 lv_obj_set_event_cb(kb, KbSaisieInt_ACT);
becanromain 6:21e96e439978 2343 lv_kb_set_ta(kb, ChSaisi);
becanromain 6:21e96e439978 2344 lv_obj_set_size(kb,200,180);
becanromain 6:21e96e439978 2345 // lv_btnm_set_map(kb, PAVE_NUMERIQUE_MAP);
becanromain 6:21e96e439978 2346 lv_obj_align(kb, ChSaisi, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
becanromain 6:21e96e439978 2347 lv_obj_set_opa_scale_enable(kb, true);
becanromain 6:21e96e439978 2348 lv_obj_set_opa_scale(kb, LV_OPA_COVER);
becanromain 6:21e96e439978 2349 lv_kb_set_cursor_manage(kb, true);
becanromain 6:21e96e439978 2350 lv_kb_set_style(kb, LV_KB_STYLE_BG, &lv_style_transp_tight);
becanromain 6:21e96e439978 2351 lv_kb_set_style(kb, LV_KB_STYLE_BTN_REL, &rel_style);
becanromain 6:21e96e439978 2352 lv_kb_set_style(kb, LV_KB_STYLE_BTN_PR, &pr_style);
becanromain 6:21e96e439978 2353 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2354 }
becanromain 6:21e96e439978 2355
becanromain 6:21e96e439978 2356 static void KbSaisieInt_ACT(lv_obj_t * event_kb, lv_event_t event)
becanromain 6:21e96e439978 2357 {
becanromain 6:21e96e439978 2358 lv_kb_def_event_cb(event_kb, event);
becanromain 6:21e96e439978 2359 if(event == LV_EVENT_APPLY ) {
becanromain 6:21e96e439978 2360 //CONVERSION VALEUR SAISIE
becanromain 6:21e96e439978 2361 const char * tmp = lv_ta_get_text(ChSaisi);
becanromain 6:21e96e439978 2362 int ValSaisie=strtof(tmp, NULL);
becanromain 6:21e96e439978 2363 //VALEUR OK
becanromain 6:21e96e439978 2364 if (ValSaisie>=SaisieInt->Min and ValSaisie<=SaisieInt->Max){
becanromain 6:21e96e439978 2365 SaisieInt->Val=ValSaisie;
becanromain 6:21e96e439978 2366 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2367 }
becanromain 6:21e96e439978 2368 else{
becanromain 6:21e96e439978 2369 //VALEUR HORS LIMITES
becanromain 6:21e96e439978 2370 //MESSAGE BOX SUR FOND GRISE
becanromain 6:21e96e439978 2371 static lv_style_t modal_style;
becanromain 6:21e96e439978 2372 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2373 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2374 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2375 FondGris2 = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2376 lv_obj_set_style(FondGris2, &modal_style);
becanromain 6:21e96e439978 2377 lv_obj_set_pos(FondGris2, 0, 0);
becanromain 6:21e96e439978 2378 lv_obj_set_size(FondGris2, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2379 lv_obj_set_opa_scale_enable(FondGris2, true);
becanromain 6:21e96e439978 2380 static const char * btns2[] = {"Ok", ""};
becanromain 6:21e96e439978 2381 mbox=lv_mbox_create(FondGris2, NULL);
becanromain 6:21e96e439978 2382 lv_mbox_add_btns(mbox, btns2);
becanromain 6:21e96e439978 2383 lv_mbox_set_text(mbox, "VALEUR SAISIE HORS LIMITES");
becanromain 6:21e96e439978 2384 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2385 lv_obj_set_event_cb(mbox, mbox_ACT);
becanromain 6:21e96e439978 2386 }
becanromain 6:21e96e439978 2387 }
becanromain 6:21e96e439978 2388 if(event == LV_EVENT_CANCEL ) {
becanromain 6:21e96e439978 2389 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2390 }
becanromain 0:cf6b1eca3e67 2391 }
becanromain 0:cf6b1eca3e67 2392
becanromain 6:21e96e439978 2393 //********************
becanromain 6:21e96e439978 2394 // SAISIE TEXTE
becanromain 6:21e96e439978 2395 //********************
becanromain 6:21e96e439978 2396 static void DdeSaisieTxt(lv_obj_t * label, lv_event_t event)//Gabor
becanromain 6:21e96e439978 2397 {
becanromain 6:21e96e439978 2398 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2399 SaisieTxt = (Txt_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2400 if (UserEC.Niveau<SaisieTxt->Niveau){
becanromain 6:21e96e439978 2401 AFFPopupMDP();
becanromain 6:21e96e439978 2402 }
becanromain 6:21e96e439978 2403 else{
becanromain 6:21e96e439978 2404 PageSaisieTxt(label);
becanromain 6:21e96e439978 2405 }
becanromain 6:21e96e439978 2406 }
becanromain 6:21e96e439978 2407 }
becanromain 6:21e96e439978 2408 static void PageSaisieTxt(lv_obj_t * label)
becanromain 6:21e96e439978 2409 {
becanromain 6:21e96e439978 2410 //STRUCTURE SAISIE
becanromain 6:21e96e439978 2411 SaisieTxt = (Txt_S *)lv_obj_get_user_data(label);
becanromain 6:21e96e439978 2412
becanromain 6:21e96e439978 2413 //FOND GRISE
becanromain 6:21e96e439978 2414 static lv_style_t modal_style;
becanromain 6:21e96e439978 2415 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2416 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2417 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2418 FondGris = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2419 lv_obj_set_style(FondGris, &modal_style);
becanromain 6:21e96e439978 2420 lv_obj_set_pos(FondGris, 0, 0);
becanromain 6:21e96e439978 2421 lv_obj_set_size(FondGris, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2422 lv_obj_set_opa_scale_enable(FondGris, true);
becanromain 6:21e96e439978 2423
becanromain 6:21e96e439978 2424 //CREATION POPUP
becanromain 6:21e96e439978 2425 lv_obj_t *PopupNum = lv_obj_create(FondGris, NULL);
becanromain 6:21e96e439978 2426 lv_obj_set_size(PopupNum,480,260);
becanromain 6:21e96e439978 2427 lv_obj_align(PopupNum, FondGris, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2428 lv_obj_set_opa_scale_enable(PopupNum, true);
becanromain 6:21e96e439978 2429 lv_obj_set_opa_scale(PopupNum, 240);
becanromain 6:21e96e439978 2430
becanromain 6:21e96e439978 2431 //TITRE
becanromain 6:21e96e439978 2432 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2433 lv_obj_set_style(label,&PG16);
becanromain 6:21e96e439978 2434 sprintf(text, "%s", SaisieTxt->Txt);
becanromain 6:21e96e439978 2435 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2436 lv_obj_align(label, PopupNum, LV_ALIGN_IN_TOP_MID, 0, 3);
becanromain 6:21e96e439978 2437 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2438 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2439
becanromain 6:21e96e439978 2440 //CHAMPS SAISI
becanromain 6:21e96e439978 2441 ChSaisi = lv_ta_create(PopupNum, NULL);
becanromain 6:21e96e439978 2442 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2443 lv_ta_set_one_line(ChSaisi, true);
becanromain 6:21e96e439978 2444 lv_obj_set_width(ChSaisi, 250);
becanromain 6:21e96e439978 2445 lv_obj_align(ChSaisi, PopupNum, LV_ALIGN_IN_TOP_LEFT, 20, 25);
becanromain 6:21e96e439978 2446 lv_obj_set_opa_scale_enable(ChSaisi, true);
becanromain 6:21e96e439978 2447 lv_obj_set_opa_scale(ChSaisi, LV_OPA_COVER);
becanromain 6:21e96e439978 2448 lv_ta_set_max_length(ChSaisi, SaisieTxt->NbCarMax);
becanromain 6:21e96e439978 2449
becanromain 6:21e96e439978 2450 //VALEUR EN COURS /Nombre de caractère maxi
becanromain 6:21e96e439978 2451 label = lv_label_create(PopupNum, NULL);
becanromain 6:21e96e439978 2452 lv_obj_set_style(label,&P12);
becanromain 6:21e96e439978 2453 sprintf(text, _("Actuel = %s\n%d caractères maximum"), SaisieTxt->Val, SaisieTxt->NbCarMax);
becanromain 6:21e96e439978 2454 lv_label_set_text(label, text);
becanromain 6:21e96e439978 2455 lv_obj_align(label, ChSaisi, LV_ALIGN_OUT_RIGHT_MID,5, 0);
becanromain 6:21e96e439978 2456 lv_obj_set_opa_scale_enable(label, true);
becanromain 6:21e96e439978 2457 lv_obj_set_opa_scale(label, LV_OPA_COVER);
becanromain 6:21e96e439978 2458
becanromain 6:21e96e439978 2459 // PAVE NUMERIQUE SAISIE
becanromain 6:21e96e439978 2460 static lv_style_t rel_style, pr_style; //STYLE CLAVIER
becanromain 6:21e96e439978 2461 lv_style_copy(&rel_style, &lv_style_btn_rel);
becanromain 6:21e96e439978 2462 rel_style.body.radius = 0;
becanromain 6:21e96e439978 2463 rel_style.body.border.width = 1;
becanromain 6:21e96e439978 2464 lv_style_copy(&pr_style, &lv_style_btn_pr);
becanromain 6:21e96e439978 2465 pr_style.body.radius = 0;
becanromain 6:21e96e439978 2466 pr_style.body.border.width = 1;
becanromain 6:21e96e439978 2467
becanromain 6:21e96e439978 2468 kb = lv_kb_create(PopupNum, NULL);
becanromain 6:21e96e439978 2469 // lv_kb_set_mode(kb, LV_KB_MODE_NUM );
becanromain 6:21e96e439978 2470 lv_obj_set_event_cb(kb, KbSaisieTxt_ACT);
becanromain 6:21e96e439978 2471 lv_kb_set_ta(kb, ChSaisi);
becanromain 6:21e96e439978 2472 lv_obj_set_size(kb,480,190); ;
becanromain 6:21e96e439978 2473 lv_obj_align(kb, PopupNum, LV_ALIGN_IN_TOP_LEFT, 0, 65);
becanromain 6:21e96e439978 2474 lv_obj_set_opa_scale_enable(kb, true);
becanromain 6:21e96e439978 2475 lv_obj_set_opa_scale(kb, LV_OPA_COVER);
becanromain 6:21e96e439978 2476 lv_kb_set_cursor_manage(kb, true);
becanromain 6:21e96e439978 2477 lv_kb_set_style(kb, LV_KB_STYLE_BG, &lv_style_transp_tight);
becanromain 6:21e96e439978 2478 lv_kb_set_style(kb, LV_KB_STYLE_BTN_REL, &rel_style);
becanromain 6:21e96e439978 2479 lv_kb_set_style(kb, LV_KB_STYLE_BTN_PR, &pr_style);
becanromain 6:21e96e439978 2480 lv_ta_set_text(ChSaisi, "");
becanromain 6:21e96e439978 2481 }
becanromain 6:21e96e439978 2482
becanromain 6:21e96e439978 2483 static void KbSaisieTxt_ACT(lv_obj_t * event_kb, lv_event_t event)
becanromain 6:21e96e439978 2484 {
becanromain 6:21e96e439978 2485 lv_kb_def_event_cb(event_kb, event);
becanromain 6:21e96e439978 2486 if(event == LV_EVENT_APPLY ) {
becanromain 6:21e96e439978 2487 //CONVERSION VALEUR SAISIE
becanromain 6:21e96e439978 2488 const char * ValSaisie = lv_ta_get_text(ChSaisi);
becanromain 6:21e96e439978 2489 string CalcNbCar = lv_ta_get_text(ChSaisi);
becanromain 6:21e96e439978 2490
becanromain 6:21e96e439978 2491 //VALEUR OK
becanromain 6:21e96e439978 2492 if (CalcNbCar.length()>0){
becanromain 6:21e96e439978 2493 SaisieTxt->Val=ValSaisie;
becanromain 6:21e96e439978 2494 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2495 }
becanromain 6:21e96e439978 2496 else{
becanromain 6:21e96e439978 2497 //VALEUR HORS LIMITES
becanromain 6:21e96e439978 2498 //MESSAGE BOX SUR FOND GRISE
becanromain 6:21e96e439978 2499 static lv_style_t modal_style;
becanromain 6:21e96e439978 2500 lv_style_copy(&modal_style, &lv_style_plain_color);
becanromain 6:21e96e439978 2501 modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK;
becanromain 6:21e96e439978 2502 modal_style.body.opa = LV_OPA_50;
becanromain 6:21e96e439978 2503 FondGris2 = lv_obj_create(lv_scr_act(), NULL);
becanromain 6:21e96e439978 2504 lv_obj_set_style(FondGris2, &modal_style);
becanromain 6:21e96e439978 2505 lv_obj_set_pos(FondGris2, 0, 0);
becanromain 6:21e96e439978 2506 lv_obj_set_size(FondGris2, LV_HOR_RES, LV_VER_RES);
becanromain 6:21e96e439978 2507 lv_obj_set_opa_scale_enable(FondGris2, true);
becanromain 6:21e96e439978 2508 static const char * btns2[] = {"Ok", ""};
becanromain 6:21e96e439978 2509 mbox=lv_mbox_create(FondGris2, NULL);
becanromain 6:21e96e439978 2510 lv_mbox_add_btns(mbox, btns2);
becanromain 6:21e96e439978 2511 lv_mbox_set_text(mbox, "SAISIR AU MOINS 1 CARACTERE");
becanromain 6:21e96e439978 2512 lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
becanromain 6:21e96e439978 2513 lv_obj_set_event_cb(mbox, mbox_ACT);
becanromain 6:21e96e439978 2514 }
becanromain 6:21e96e439978 2515 }
becanromain 6:21e96e439978 2516 if(event == LV_EVENT_CANCEL ) {
becanromain 6:21e96e439978 2517 lv_obj_del_async(FondGris);
becanromain 6:21e96e439978 2518 }
becanromain 6:21e96e439978 2519 }
becanromain 6:21e96e439978 2520
becanromain 6:21e96e439978 2521
becanromain 6:21e96e439978 2522
becanromain 6:21e96e439978 2523 //FERMETURE POPUP MESSAGE BOX
becanromain 6:21e96e439978 2524 static void mbox_ACT(lv_obj_t * obj, lv_event_t event)
becanromain 6:21e96e439978 2525 {
becanromain 6:21e96e439978 2526 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2527 lv_obj_del_async(FondGris2);
becanromain 6:21e96e439978 2528 }
becanromain 6:21e96e439978 2529 }
becanromain 6:21e96e439978 2530
becanromain 6:21e96e439978 2531
becanromain 0:cf6b1eca3e67 2532
becanromain 0:cf6b1eca3e67 2533 //**************************
becanromain 0:cf6b1eca3e67 2534 // ACTION BOUTONS MENUS
becanromain 0:cf6b1eca3e67 2535 //**************************
becanromain 0:cf6b1eca3e67 2536
becanromain 0:cf6b1eca3e67 2537 static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event)
becanromain 0:cf6b1eca3e67 2538 {
becanromain 0:cf6b1eca3e67 2539 if(event == LV_EVENT_PRESSING) {
becanromain 0:cf6b1eca3e67 2540 Reglage_R= lv_slider_get_value(obj);
becanromain 0:cf6b1eca3e67 2541 sprintf(text, " %d ",Reglage_R );
becanromain 0:cf6b1eca3e67 2542 lv_label_set_text(Val_R, text);
becanromain 0:cf6b1eca3e67 2543 }
becanromain 0:cf6b1eca3e67 2544 }
becanromain 0:cf6b1eca3e67 2545
becanromain 0:cf6b1eca3e67 2546 static void BPRAZ_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2547 {
becanromain 0:cf6b1eca3e67 2548 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2549 TpsMinEntre2Puls=999999;
becanromain 6:21e96e439978 2550 TpsMaPpe=0;
becanromain 0:cf6b1eca3e67 2551 TpsMaxEntre2Puls=0;
becanromain 0:cf6b1eca3e67 2552 CptPuls=0;
becanromain 6:21e96e439978 2553 Volume.Val=0;
becanromain 6:21e96e439978 2554 Duree.Val=50*60;
becanromain 0:cf6b1eca3e67 2555 for (NumDent=20;NumDent>0;NumDent--){
becanromain 0:cf6b1eca3e67 2556 TpsEntre2Puls[NumDent]=0;
becanromain 0:cf6b1eca3e67 2557 MemTpsPuls=0;
becanromain 0:cf6b1eca3e67 2558 MemTps16Puls=0;
becanromain 0:cf6b1eca3e67 2559 }
becanromain 0:cf6b1eca3e67 2560 }
becanromain 0:cf6b1eca3e67 2561 }
becanromain 4:6a3d12663549 2562 static void BPPOMPE_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 4:6a3d12663549 2563 {
becanromain 4:6a3d12663549 2564 if(event == LV_EVENT_CLICKED) {
becanromain 4:6a3d12663549 2565 DO_POMPE=!DO_POMPE;
becanromain 4:6a3d12663549 2566 }
becanromain 4:6a3d12663549 2567 }
becanromain 4:6a3d12663549 2568 static void LANGUE_FR_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 4:6a3d12663549 2569 {
becanromain 4:6a3d12663549 2570 if(event == LV_EVENT_CLICKED) {
becanromain 4:6a3d12663549 2571 lv_i18n_set_locale("fr");
becanromain 6:21e96e439978 2572 AFFBandeauHaut(1);
becanromain 4:6a3d12663549 2573 AFFPage(PageAff);
becanromain 4:6a3d12663549 2574 }
becanromain 4:6a3d12663549 2575 }
becanromain 4:6a3d12663549 2576 static void LANGUE_EN_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 4:6a3d12663549 2577 {
becanromain 4:6a3d12663549 2578 if(event == LV_EVENT_CLICKED) {
becanromain 4:6a3d12663549 2579 lv_i18n_set_locale("en-GB");
becanromain 6:21e96e439978 2580 AFFBandeauHaut(1);
becanromain 4:6a3d12663549 2581 AFFPage(PageAff);
becanromain 4:6a3d12663549 2582 }
becanromain 4:6a3d12663549 2583 }
becanromain 6:21e96e439978 2584
becanromain 6:21e96e439978 2585 static void BPMENU_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 6:21e96e439978 2586 {
becanromain 6:21e96e439978 2587 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2588 AFFBandeauHaut(2);
becanromain 6:21e96e439978 2589 }
becanromain 6:21e96e439978 2590 }
becanromain 6:21e96e439978 2591
becanromain 0:cf6b1eca3e67 2592 static void M100_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2593 {
becanromain 0:cf6b1eca3e67 2594 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2595 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2596 PosX_MenuCible = -lv_obj_get_x(M100);
becanromain 0:cf6b1eca3e67 2597 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2598 NumSousMenu=100;
becanromain 0:cf6b1eca3e67 2599 }
becanromain 0:cf6b1eca3e67 2600 }
becanromain 0:cf6b1eca3e67 2601 static void M200_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2602 {
becanromain 0:cf6b1eca3e67 2603 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2604 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2605 PosX_MenuCible = -lv_obj_get_x(M200);
becanromain 0:cf6b1eca3e67 2606 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2607 NumSousMenu=200;
becanromain 0:cf6b1eca3e67 2608 }
becanromain 0:cf6b1eca3e67 2609 }
becanromain 0:cf6b1eca3e67 2610 static void M300_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2611 {
becanromain 0:cf6b1eca3e67 2612 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2613 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2614 PosX_MenuCible = -lv_obj_get_x(M300);
becanromain 0:cf6b1eca3e67 2615 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2616 NumSousMenu=300;
becanromain 0:cf6b1eca3e67 2617 }
becanromain 0:cf6b1eca3e67 2618 }
becanromain 0:cf6b1eca3e67 2619 static void M400_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2620 {
becanromain 0:cf6b1eca3e67 2621 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2622 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2623 PosX_MenuCible = -lv_obj_get_x(M400);
becanromain 0:cf6b1eca3e67 2624 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2625 NumSousMenu=400;
becanromain 0:cf6b1eca3e67 2626 }
becanromain 0:cf6b1eca3e67 2627 }
becanromain 0:cf6b1eca3e67 2628 static void M500_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2629 {
becanromain 0:cf6b1eca3e67 2630 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2631 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2632 PosX_MenuCible = -lv_obj_get_x(M500);
becanromain 0:cf6b1eca3e67 2633 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2634 NumSousMenu=500;
becanromain 0:cf6b1eca3e67 2635 }
becanromain 0:cf6b1eca3e67 2636 }
becanromain 0:cf6b1eca3e67 2637 static void M600_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2638 {
becanromain 0:cf6b1eca3e67 2639 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2640 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 0:cf6b1eca3e67 2641 PosX_MenuCible = -lv_obj_get_x(M600);
becanromain 0:cf6b1eca3e67 2642 DdeAlignMenu=1;
becanromain 0:cf6b1eca3e67 2643 NumSousMenu=600;
becanromain 0:cf6b1eca3e67 2644 }
becanromain 0:cf6b1eca3e67 2645 }
becanromain 6:21e96e439978 2646 static void M700_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 6:21e96e439978 2647 {
becanromain 6:21e96e439978 2648 if(event == LV_EVENT_CLICKED) {
becanromain 6:21e96e439978 2649 PosX_MenuDepart = lv_obj_get_x(BandeauHaut);
becanromain 6:21e96e439978 2650 PosX_MenuCible = -lv_obj_get_x(M700);
becanromain 6:21e96e439978 2651 DdeAlignMenu=1;
becanromain 6:21e96e439978 2652 NumSousMenu=700;
becanromain 6:21e96e439978 2653 }
becanromain 6:21e96e439978 2654 }
becanromain 0:cf6b1eca3e67 2655 //**************************
becanromain 0:cf6b1eca3e67 2656 // ACTION BOUTONS SOUS MENUS
becanromain 0:cf6b1eca3e67 2657 //**************************
becanromain 6:21e96e439978 2658 static void SM_ACT(lv_obj_t * btn, lv_event_t event)
becanromain 0:cf6b1eca3e67 2659 {
becanromain 0:cf6b1eca3e67 2660 if(event == LV_EVENT_CLICKED) {
becanromain 0:cf6b1eca3e67 2661 //VERIFICATION AUTORISATION ACCES
becanromain 0:cf6b1eca3e67 2662 uint8_t EtatBp = lv_btn_get_state(btn);
becanromain 6:21e96e439978 2663 if (EtatBp==LV_BTN_STATE_INA){
becanromain 0:cf6b1eca3e67 2664 AFFPopupMDP();
becanromain 0:cf6b1eca3e67 2665 }
becanromain 0:cf6b1eca3e67 2666 else{
becanromain 6:21e96e439978 2667 DdeFermBandeauHaut=true;
becanromain 0:cf6b1eca3e67 2668 TpsAvFermSousMenu=0;
becanromain 6:21e96e439978 2669 // AFFPage(101);
becanromain 6:21e96e439978 2670 lv_obj_t * label = lv_obj_get_child(btn, NULL);
becanromain 6:21e96e439978 2671 const char * txt = lv_label_get_text(label);
becanromain 6:21e96e439978 2672 if(strcmp(txt, _("M101")) == 0) {AFFPage(101);}
becanromain 6:21e96e439978 2673 if(strcmp(txt, _("M102")) == 0) {AFFPage(102);}
becanromain 6:21e96e439978 2674 if(strcmp(txt, _("M103")) == 0) {AFFPage(103);}
becanromain 6:21e96e439978 2675 if(strcmp(txt, _("M104")) == 0) {AFFPage(104);}
becanromain 6:21e96e439978 2676 if(strcmp(txt, _("M105")) == 0) {AFFPage(105);}
becanromain 6:21e96e439978 2677 if(strcmp(txt, _("M106")) == 0) {AFFPage(106);}
becanromain 6:21e96e439978 2678 if(strcmp(txt, _("M107")) == 0) {AFFPage(107);}
becanromain 6:21e96e439978 2679
becanromain 6:21e96e439978 2680 if(strcmp(txt, _("M201")) == 0) {AFFPage(201);}
becanromain 6:21e96e439978 2681 if(strcmp(txt, _("M202")) == 0) {AFFPage(202);}
becanromain 6:21e96e439978 2682 if(strcmp(txt, _("M203")) == 0) {AFFPage(203);}
becanromain 6:21e96e439978 2683 if(strcmp(txt, _("M204")) == 0) {AFFPage(204);}
becanromain 6:21e96e439978 2684 if(strcmp(txt, _("M205")) == 0) {AFFPage(205);}
becanromain 6:21e96e439978 2685 if(strcmp(txt, _("M206")) == 0) {AFFPage(206);}
becanromain 6:21e96e439978 2686 if(strcmp(txt, _("M207")) == 0) {AFFPage(207);}
becanromain 6:21e96e439978 2687
becanromain 6:21e96e439978 2688 if(strcmp(txt, _("M301")) == 0) {AFFPage(301);}
becanromain 6:21e96e439978 2689 if(strcmp(txt, _("M302")) == 0) {AFFPage(302);}
becanromain 6:21e96e439978 2690 if(strcmp(txt, _("M303")) == 0) {AFFPage(303);}
becanromain 6:21e96e439978 2691 if(strcmp(txt, _("M304")) == 0) {AFFPage(304);}
becanromain 6:21e96e439978 2692 if(strcmp(txt, _("M305")) == 0) {AFFPage(305);}
becanromain 6:21e96e439978 2693 if(strcmp(txt, _("M306")) == 0) {AFFPage(306);}
becanromain 6:21e96e439978 2694 if(strcmp(txt, _("M307")) == 0) {AFFPage(307);}
becanromain 6:21e96e439978 2695
becanromain 6:21e96e439978 2696 if(strcmp(txt, _("M401")) == 0) {AFFPage(401);}
becanromain 6:21e96e439978 2697 if(strcmp(txt, _("M402")) == 0) {AFFPage(402);}
becanromain 6:21e96e439978 2698 if(strcmp(txt, _("M403")) == 0) {AFFPage(403);}
becanromain 6:21e96e439978 2699 if(strcmp(txt, _("M404")) == 0) {AFFPage(404);}
becanromain 6:21e96e439978 2700 if(strcmp(txt, _("M405")) == 0) {AFFPage(405);}
becanromain 6:21e96e439978 2701 if(strcmp(txt, _("M406")) == 0) {AFFPage(406);}
becanromain 6:21e96e439978 2702 if(strcmp(txt, _("M407")) == 0) {AFFPage(407);}
becanromain 6:21e96e439978 2703
becanromain 6:21e96e439978 2704 if(strcmp(txt, _("M501")) == 0) {AFFPage(501);}
becanromain 6:21e96e439978 2705 if(strcmp(txt, _("M502")) == 0) {AFFPage(502);}
becanromain 6:21e96e439978 2706 if(strcmp(txt, _("M503")) == 0) {AFFPage(503);}
becanromain 6:21e96e439978 2707 if(strcmp(txt, _("M504")) == 0) {AFFPage(504);}
becanromain 6:21e96e439978 2708 if(strcmp(txt, _("M505")) == 0) {AFFPage(505);}
becanromain 6:21e96e439978 2709 if(strcmp(txt, _("M506")) == 0) {AFFPage(506);}
becanromain 6:21e96e439978 2710 if(strcmp(txt, _("M507")) == 0) {AFFPage(507);}
becanromain 6:21e96e439978 2711
becanromain 6:21e96e439978 2712 if(strcmp(txt, _("M601")) == 0) {AFFPage(601);}
becanromain 6:21e96e439978 2713 if(strcmp(txt, _("M602")) == 0) {AFFPage(602);}
becanromain 6:21e96e439978 2714 if(strcmp(txt, _("M603")) == 0) {AFFPage(603);}
becanromain 6:21e96e439978 2715 if(strcmp(txt, _("M604")) == 0) {AFFPage(604);}
becanromain 6:21e96e439978 2716 if(strcmp(txt, _("M605")) == 0) {AFFPage(605);}
becanromain 6:21e96e439978 2717 if(strcmp(txt, _("M606")) == 0) {AFFPage(606);}
becanromain 6:21e96e439978 2718 if(strcmp(txt, _("M607")) == 0) {AFFPage(607);}
becanromain 6:21e96e439978 2719
becanromain 6:21e96e439978 2720 if(strcmp(txt, _("M701")) == 0) {AFFPage(701);}
becanromain 6:21e96e439978 2721 if(strcmp(txt, _("M702")) == 0) {AFFPage(702);}
becanromain 6:21e96e439978 2722 if(strcmp(txt, _("M703")) == 0) {AFFPage(703);}
becanromain 6:21e96e439978 2723 if(strcmp(txt, _("M704")) == 0) {AFFPage(704);}
becanromain 6:21e96e439978 2724 if(strcmp(txt, _("M705")) == 0) {AFFPage(705);}
becanromain 6:21e96e439978 2725 if(strcmp(txt, _("M706")) == 0) {AFFPage(706);}
becanromain 6:21e96e439978 2726 if(strcmp(txt, _("M707")) == 0) {AFFPage(707);}
becanromain 6:21e96e439978 2727
becanromain 0:cf6b1eca3e67 2728 }
becanromain 0:cf6b1eca3e67 2729 }
becanromain 0:cf6b1eca3e67 2730 }
becanromain 0:cf6b1eca3e67 2731
becanromain 0:cf6b1eca3e67 2732
becanromain 0:cf6b1eca3e67 2733 //********************
becanromain 0:cf6b1eca3e67 2734 // FONCTIONS GENERALES
becanromain 0:cf6b1eca3e67 2735 //********************
becanromain 0:cf6b1eca3e67 2736 void lv_ticker_func()
becanromain 0:cf6b1eca3e67 2737 {
becanromain 0:cf6b1eca3e67 2738 lv_tick_inc(5); //Call lv_tick_inc(x) every x milliseconds in a Timer or Task (x should be between 1 and 10). It is required for the internal timing of LittlevGL.
becanromain 0:cf6b1eca3e67 2739 }
becanromain 0:cf6b1eca3e67 2740
becanromain 0:cf6b1eca3e67 2741 //FONCTION D'AFFICHAGE
becanromain 0:cf6b1eca3e67 2742 void my_disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p)
becanromain 0:cf6b1eca3e67 2743 {
becanromain 0:cf6b1eca3e67 2744 //The most simple case (but also the slowest) to put all pixels to the screen one-by-one
becanromain 0:cf6b1eca3e67 2745 uint16_t x, y;
becanromain 0:cf6b1eca3e67 2746 for(y = area->y1; y <= area->y2; y++) {
becanromain 0:cf6b1eca3e67 2747 for(x = area->x1; x <= area->x2; x++) {
becanromain 0:cf6b1eca3e67 2748
becanromain 0:cf6b1eca3e67 2749 lcd.DrawPixel( x, y, color_p->full);
becanromain 0:cf6b1eca3e67 2750 color_p++;
becanromain 0:cf6b1eca3e67 2751 }
becanromain 0:cf6b1eca3e67 2752 }
becanromain 0:cf6b1eca3e67 2753
becanromain 0:cf6b1eca3e67 2754 // IMPORTANT!!!
becanromain 0:cf6b1eca3e67 2755 // Inform the graphics library that you are ready with the flushing
becanromain 0:cf6b1eca3e67 2756 lv_disp_flush_ready(disp_drv);
becanromain 0:cf6b1eca3e67 2757 }
becanromain 0:cf6b1eca3e67 2758
becanromain 0:cf6b1eca3e67 2759 //FONCTION RECUPERATION COORDONNEES APPUI
becanromain 0:cf6b1eca3e67 2760 bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
becanromain 0:cf6b1eca3e67 2761 {
becanromain 0:cf6b1eca3e67 2762 static lv_coord_t last_x = 0;
becanromain 0:cf6b1eca3e67 2763 static lv_coord_t last_y = 0;
becanromain 0:cf6b1eca3e67 2764
becanromain 0:cf6b1eca3e67 2765 //Save the state and save the pressed coordinate
becanromain 0:cf6b1eca3e67 2766 ts.GetState(&TS_State);
becanromain 0:cf6b1eca3e67 2767
becanromain 0:cf6b1eca3e67 2768 if(TS_State.touchDetected == 1) {
becanromain 0:cf6b1eca3e67 2769 data->state = LV_INDEV_STATE_PR;
becanromain 0:cf6b1eca3e67 2770 } else {
becanromain 0:cf6b1eca3e67 2771 data->state = LV_INDEV_STATE_REL;
becanromain 0:cf6b1eca3e67 2772 }
becanromain 0:cf6b1eca3e67 2773
becanromain 0:cf6b1eca3e67 2774 //data->state = tttt ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
becanromain 0:cf6b1eca3e67 2775 // if(data->state == LV_INDEV_STATE_PR){
becanromain 0:cf6b1eca3e67 2776 if(data->state == LV_INDEV_STATE_PR) {
becanromain 0:cf6b1eca3e67 2777 //touchpad_get_xy(&last_x, &last_y);
becanromain 0:cf6b1eca3e67 2778 last_x = TS_State.touchX[0];
becanromain 0:cf6b1eca3e67 2779 last_y = TS_State.touchY[0];
becanromain 0:cf6b1eca3e67 2780 }
becanromain 0:cf6b1eca3e67 2781
becanromain 0:cf6b1eca3e67 2782 //Set the coordinates (if released use the last pressed coordinates)
becanromain 0:cf6b1eca3e67 2783 data->point.x = last_x;
becanromain 0:cf6b1eca3e67 2784 data->point.y = last_y;
becanromain 0:cf6b1eca3e67 2785
becanromain 0:cf6b1eca3e67 2786 X = TS_State.touchDetected ;
becanromain 0:cf6b1eca3e67 2787
becanromain 0:cf6b1eca3e67 2788
becanromain 0:cf6b1eca3e67 2789
becanromain 0:cf6b1eca3e67 2790 return false; //Return `false` because we are not buffering and no more data to read
becanromain 0:cf6b1eca3e67 2791 }
becanromain 0:cf6b1eca3e67 2792
becanromain 6:21e96e439978 2793 //FONCTION CONVERSION STRING EN CHAINE DE CARACTERE
becanromain 6:21e96e439978 2794 static char *S(string S){
becanromain 6:21e96e439978 2795 char Ch[100];
becanromain 6:21e96e439978 2796 for (int i = 0; i < S.length(); i++) { Ch[i] = S[i];}
becanromain 6:21e96e439978 2797 return Ch;
becanromain 6:21e96e439978 2798 }
becanromain 6:21e96e439978 2799 // FONCTION CONVERSION DUREE EN SECONDE EN CHAINE DE CARACTERES hh:mm:ss
becanromain 6:21e96e439978 2800 static char *HHMMSS(int32_t Seconde){
becanromain 6:21e96e439978 2801 char Ch[8];
becanromain 6:21e96e439978 2802 char HH[2];
becanromain 6:21e96e439978 2803 char MM[2];
becanromain 6:21e96e439978 2804 char SS[2];
becanromain 6:21e96e439978 2805 int32_t h = (Seconde / 3600);
becanromain 6:21e96e439978 2806 int32_t m = ((Seconde - (h * 3600)) / 60);
becanromain 6:21e96e439978 2807 int32_t s = (Seconde - ((h * 3600) + (m * 60)));
becanromain 6:21e96e439978 2808 sprintf(HH, "%d",h );
becanromain 6:21e96e439978 2809 if (h<10){sprintf(HH, "0%d",h );}
becanromain 6:21e96e439978 2810 sprintf(MM, "%d",m );
becanromain 6:21e96e439978 2811 if (m<10){sprintf(MM, "0%d",m );}
becanromain 6:21e96e439978 2812 sprintf(SS, "%d",s );
becanromain 6:21e96e439978 2813 if (s<10){sprintf(SS, "0%d",s );}
becanromain 6:21e96e439978 2814 sprintf(Ch, "%s:%s:%s",HH,MM,SS );
becanromain 6:21e96e439978 2815 return Ch;
becanromain 6:21e96e439978 2816
becanromain 6:21e96e439978 2817 }
becanromain 6:21e96e439978 2818
becanromain 6:21e96e439978 2819 /*****************************
becanromain 6:21e96e439978 2820 **********STYLES**************
becanromain 6:21e96e439978 2821 *****************************/
becanromain 6:21e96e439978 2822 static void StyleBPM(lv_obj_t * Obj){
becanromain 6:21e96e439978 2823 static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
becanromain 6:21e96e439978 2824
becanromain 6:21e96e439978 2825 lv_style_copy(&btn_rel, &lv_style_btn_rel);
becanromain 6:21e96e439978 2826 btn_rel.text.font = &RB_lv_font_roboto_bold_18;
becanromain 6:21e96e439978 2827 btn_rel.body.padding.top = 10;
becanromain 6:21e96e439978 2828 btn_rel.body.padding.bottom = 10;
becanromain 6:21e96e439978 2829 btn_rel.body.main_color = LV_COLOR_MAKE(R3, G3, B3);
becanromain 6:21e96e439978 2830 btn_rel.body.grad_color = LV_COLOR_MAKE(R4, G4, B4);
becanromain 6:21e96e439978 2831 btn_rel.body.border.color = LV_COLOR_MAKE(R5, G5, B5);
becanromain 6:21e96e439978 2832 btn_rel.text.color = LV_COLOR_MAKE(R6, G6, B6);
becanromain 6:21e96e439978 2833
becanromain 6:21e96e439978 2834 lv_style_copy(&btn_pr, &lv_style_btn_pr);
becanromain 6:21e96e439978 2835 btn_pr.text.font = &RB_lv_font_roboto_bold_16;
becanromain 6:21e96e439978 2836 btn_pr.body.padding.top = 10;
becanromain 6:21e96e439978 2837 btn_pr.body.padding.bottom = 10;
becanromain 6:21e96e439978 2838 btn_pr.body.main_color = LV_COLOR_MAKE(R7, G7, B7);
becanromain 6:21e96e439978 2839 btn_pr.body.grad_color = LV_COLOR_MAKE(R8, G8, B8);
becanromain 6:21e96e439978 2840 btn_pr.body.border.color = LV_COLOR_MAKE(R9, G9, B9);
becanromain 6:21e96e439978 2841 btn_pr.text.color = LV_COLOR_MAKE(R10, G10, B10);
becanromain 6:21e96e439978 2842
becanromain 6:21e96e439978 2843 lv_style_copy(&btn_tgl_rel, &btn_rel);
becanromain 6:21e96e439978 2844 btn_tgl_rel.text.font = &RB_lv_font_roboto_bold_16;
becanromain 6:21e96e439978 2845 btn_tgl_rel.body.padding.top = 10;
becanromain 6:21e96e439978 2846 btn_tgl_rel.body.padding.bottom = 10;
becanromain 6:21e96e439978 2847
becanromain 6:21e96e439978 2848 lv_style_copy(&btn_tgl_pr, &btn_pr);
becanromain 6:21e96e439978 2849 btn_tgl_pr.text.font = &RB_lv_font_roboto_bold_16;
becanromain 6:21e96e439978 2850 btn_tgl_pr.body.padding.top = 10;
becanromain 6:21e96e439978 2851 btn_tgl_pr.body.padding.bottom = 10;
becanromain 6:21e96e439978 2852
becanromain 6:21e96e439978 2853 lv_style_copy(&btn_ina, &lv_style_btn_ina);
becanromain 6:21e96e439978 2854 btn_ina.text.font = &RB_lv_font_roboto_bold_16;
becanromain 6:21e96e439978 2855 btn_ina.body.padding.top = 10;
becanromain 6:21e96e439978 2856 btn_ina.body.padding.bottom = 10;
becanromain 6:21e96e439978 2857 btn_ina.body.main_color = LV_COLOR_MAKE(R11, G11, B11);
becanromain 6:21e96e439978 2858 btn_ina.body.grad_color = LV_COLOR_MAKE(R12, G12, B12);
becanromain 6:21e96e439978 2859 btn_ina.body.border.color = LV_COLOR_MAKE(R13, G13, B13);
becanromain 6:21e96e439978 2860 btn_ina.text.color = LV_COLOR_MAKE(R14, G14, B14);
becanromain 6:21e96e439978 2861
becanromain 6:21e96e439978 2862 lv_btn_set_style(Obj, LV_BTN_STATE_REL, &btn_rel);
becanromain 6:21e96e439978 2863 lv_btn_set_style(Obj, LV_BTN_STATE_PR, &btn_pr);
becanromain 6:21e96e439978 2864 lv_btn_set_style(Obj, LV_BTN_STATE_TGL_REL, &btn_pr);
becanromain 6:21e96e439978 2865 lv_btn_set_style(Obj, LV_BTN_STATE_TGL_PR, &btn_tgl_pr);
becanromain 6:21e96e439978 2866 lv_btn_set_style(Obj, LV_BTN_STATE_INA, &btn_ina);
becanromain 6:21e96e439978 2867 }
becanromain 6:21e96e439978 2868
becanromain 6:21e96e439978 2869 static void StyleBPSM(lv_obj_t * Obj){
becanromain 6:21e96e439978 2870
becanromain 6:21e96e439978 2871 static lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina;
becanromain 6:21e96e439978 2872
becanromain 6:21e96e439978 2873 lv_style_copy(&btn_rel, &lv_style_btn_rel);
becanromain 6:21e96e439978 2874 btn_rel.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 2875 btn_rel.body.padding.top = 10;
becanromain 6:21e96e439978 2876 btn_rel.body.padding.bottom = 10;
becanromain 6:21e96e439978 2877 btn_rel.body.padding.left = 5;
becanromain 6:21e96e439978 2878 btn_rel.body.padding.right = 50;
becanromain 6:21e96e439978 2879 btn_rel.body.main_color = LV_COLOR_MAKE(R3, G3, B3);
becanromain 6:21e96e439978 2880 btn_rel.body.grad_color = LV_COLOR_MAKE(R4, G4, B4);
becanromain 6:21e96e439978 2881 btn_rel.body.border.color = LV_COLOR_MAKE(R5, G5, B5);
becanromain 6:21e96e439978 2882 btn_rel.text.color = LV_COLOR_MAKE(R6, G6, B6);
becanromain 6:21e96e439978 2883
becanromain 6:21e96e439978 2884 lv_style_copy(&btn_pr, &lv_style_btn_pr);
becanromain 6:21e96e439978 2885 btn_pr.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 2886 btn_pr.body.padding.top = 10;
becanromain 6:21e96e439978 2887 btn_pr.body.padding.bottom = 10;
becanromain 6:21e96e439978 2888 btn_pr.body.padding.left = 5;
becanromain 6:21e96e439978 2889 btn_pr.body.padding.right = 50;
becanromain 6:21e96e439978 2890 btn_pr.body.main_color = LV_COLOR_MAKE(R7, G7, B7);
becanromain 6:21e96e439978 2891 btn_pr.body.grad_color = LV_COLOR_MAKE(R8, G8, B8);
becanromain 6:21e96e439978 2892 btn_pr.body.border.color = LV_COLOR_MAKE(R9, G9, B9);
becanromain 6:21e96e439978 2893 btn_pr.text.color = LV_COLOR_MAKE(R10, G10, B10);
becanromain 6:21e96e439978 2894
becanromain 6:21e96e439978 2895 lv_style_copy(&btn_tgl_rel, &btn_rel);
becanromain 6:21e96e439978 2896 btn_tgl_rel.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 2897 btn_tgl_rel.body.padding.top = 10;
becanromain 6:21e96e439978 2898 btn_tgl_rel.body.padding.bottom = 10;
becanromain 6:21e96e439978 2899 btn_tgl_rel.body.padding.left = 5;
becanromain 6:21e96e439978 2900 btn_tgl_rel.body.padding.right = 50;
becanromain 6:21e96e439978 2901
becanromain 6:21e96e439978 2902 lv_style_copy(&btn_tgl_pr, &btn_pr);
becanromain 6:21e96e439978 2903 btn_tgl_pr.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 2904 btn_tgl_pr.body.padding.top = 10;
becanromain 6:21e96e439978 2905 btn_tgl_pr.body.padding.bottom = 10;
becanromain 6:21e96e439978 2906 btn_tgl_pr.body.padding.left = 5;
becanromain 6:21e96e439978 2907 btn_tgl_pr.body.padding.right = 50;
becanromain 6:21e96e439978 2908
becanromain 6:21e96e439978 2909 lv_style_copy(&btn_ina, &lv_style_btn_ina);
becanromain 6:21e96e439978 2910 btn_ina.text.font = &RB_lv_font_roboto_16;
becanromain 6:21e96e439978 2911 btn_ina.body.padding.top = 10;
becanromain 6:21e96e439978 2912 btn_ina.body.padding.bottom = 10;
becanromain 6:21e96e439978 2913 btn_ina.body.padding.left = 5;
becanromain 6:21e96e439978 2914 btn_ina.body.padding.right = 50;
becanromain 6:21e96e439978 2915 btn_ina.body.main_color = LV_COLOR_MAKE(R11, G11, B11);
becanromain 6:21e96e439978 2916 btn_ina.body.grad_color = LV_COLOR_MAKE(R12, G12, B12);
becanromain 6:21e96e439978 2917 btn_ina.body.border.color = LV_COLOR_MAKE(R13, G13, B13);
becanromain 6:21e96e439978 2918 btn_ina.text.color = LV_COLOR_MAKE(R14, G14, B14);
becanromain 6:21e96e439978 2919
becanromain 6:21e96e439978 2920 lv_list_set_style(Obj, LV_LIST_STYLE_BTN_REL, &btn_rel);
becanromain 6:21e96e439978 2921 lv_list_set_style(Obj, LV_LIST_STYLE_BTN_PR, &btn_pr);
becanromain 6:21e96e439978 2922 lv_list_set_style(Obj, LV_LIST_STYLE_BTN_TGL_REL, &btn_pr);
becanromain 6:21e96e439978 2923 lv_list_set_style(Obj, LV_LIST_STYLE_BTN_TGL_PR, &btn_tgl_pr);
becanromain 6:21e96e439978 2924 lv_list_set_style(Obj, LV_LIST_STYLE_BTN_INA, &btn_ina);
becanromain 6:21e96e439978 2925
becanromain 6:21e96e439978 2926 }
becanromain 6:21e96e439978 2927
becanromain 6:21e96e439978 2928
becanromain 6:21e96e439978 2929
becanromain 6:21e96e439978 2930