char input
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG lvgl_RB FastPWM millis
main.cpp@5:cab3e2179cbf, 2020-01-29 (annotated)
- Committer:
- kisvegabor
- Date:
- Wed Jan 29 06:48:41 2020 +0000
- Revision:
- 5:cab3e2179cbf
- Parent:
- 4:6a3d12663549
- Child:
- 6:21e96e439978
declare custom fonts
Who changed what in which revision?
User | Revision | Line number | New 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 | 4:6a3d12663549 | 9 | #include "lv_i18n.h" |
becanromain | 4:6a3d12663549 | 10 | |
becanromain | 4:6a3d12663549 | 11 | #include "lv_theme_rb.h" //GABOR |
becanromain | 0:cf6b1eca3e67 | 12 | |
becanromain | 0:cf6b1eca3e67 | 13 | Ticker ticker; //Initialize system tick |
becanromain | 0:cf6b1eca3e67 | 14 | LCD_DISCO_F746NG lcd; //Initialize display driver |
becanromain | 0:cf6b1eca3e67 | 15 | TS_DISCO_F746NG ts; //Initialize touchpad driver |
becanromain | 0:cf6b1eca3e67 | 16 | TS_StateTypeDef TS_State; //Initialize touch state sctruct |
becanromain | 0:cf6b1eca3e67 | 17 | |
becanromain | 0:cf6b1eca3e67 | 18 | Serial serial(USBTX, USBRX); |
becanromain | 0:cf6b1eca3e67 | 19 | |
becanromain | 0:cf6b1eca3e67 | 20 | /********************* |
becanromain | 0:cf6b1eca3e67 | 21 | * ENTREES SORTIES |
becanromain | 0:cf6b1eca3e67 | 22 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 23 | //TENSION BATTERIE |
becanromain | 0:cf6b1eca3e67 | 24 | AnalogIn AI_TENSION_BAT(A4); |
becanromain | 0:cf6b1eca3e67 | 25 | |
becanromain | 0:cf6b1eca3e67 | 26 | //PWM |
becanromain | 0:cf6b1eca3e67 | 27 | FastPWM fastpwm(D12,1); //steup pwm output on pin d12 with a prescaler of 1 |
becanromain | 4:6a3d12663549 | 28 | |
becanromain | 4:6a3d12663549 | 29 | //MARCHE POMPE |
becanromain | 4:6a3d12663549 | 30 | DigitalOut DO_POMPE(D13); |
becanromain | 4:6a3d12663549 | 31 | |
becanromain | 0:cf6b1eca3e67 | 32 | //COMPTEUR IMPULSION |
becanromain | 0:cf6b1eca3e67 | 33 | DigitalIn DI_CPTPuls(D7); |
becanromain | 0:cf6b1eca3e67 | 34 | //InterruptIn DI_CPTPuls(D7); // |
becanromain | 4:6a3d12663549 | 35 | |
becanromain | 4:6a3d12663549 | 36 | |
becanromain | 0:cf6b1eca3e67 | 37 | |
becanromain | 0:cf6b1eca3e67 | 38 | /********************** |
becanromain | 0:cf6b1eca3e67 | 39 | * VARIABLES GENERALES |
becanromain | 0:cf6b1eca3e67 | 40 | **********************/ |
becanromain | 0:cf6b1eca3e67 | 41 | int X; |
becanromain | 0:cf6b1eca3e67 | 42 | int Y; |
becanromain | 0:cf6b1eca3e67 | 43 | Timer tempo; |
becanromain | 0:cf6b1eca3e67 | 44 | bool Top1ms; |
becanromain | 0:cf6b1eca3e67 | 45 | bool Top10ms; |
becanromain | 0:cf6b1eca3e67 | 46 | bool Top100ms; |
becanromain | 0:cf6b1eca3e67 | 47 | bool Top1s; |
becanromain | 0:cf6b1eca3e67 | 48 | bool Top5s; |
becanromain | 0:cf6b1eca3e67 | 49 | bool Top1min; |
becanromain | 0:cf6b1eca3e67 | 50 | char text[100]; |
becanromain | 0:cf6b1eca3e67 | 51 | char text2[100]; |
becanromain | 0:cf6b1eca3e67 | 52 | |
becanromain | 0:cf6b1eca3e67 | 53 | float TensionBat; |
becanromain | 0:cf6b1eca3e67 | 54 | float MoyTensBat[101]; |
becanromain | 0:cf6b1eca3e67 | 55 | int CsgPompe=0; |
becanromain | 0:cf6b1eca3e67 | 56 | |
becanromain | 0:cf6b1eca3e67 | 57 | uint64_t Micros=0; |
becanromain | 0:cf6b1eca3e67 | 58 | uint64_t CalcTpsCy=0; |
becanromain | 0:cf6b1eca3e67 | 59 | float TpsCy=0; |
becanromain | 0:cf6b1eca3e67 | 60 | |
becanromain | 0:cf6b1eca3e67 | 61 | uint64_t MemMicros0=0; |
becanromain | 0:cf6b1eca3e67 | 62 | uint64_t MemMicros1=0; |
becanromain | 0:cf6b1eca3e67 | 63 | uint64_t MemMicros2=0; |
becanromain | 0:cf6b1eca3e67 | 64 | uint64_t MemMicros3=0; |
becanromain | 0:cf6b1eca3e67 | 65 | uint64_t MemMicros4=0; |
becanromain | 0:cf6b1eca3e67 | 66 | uint64_t MemMicros5=0; |
becanromain | 0:cf6b1eca3e67 | 67 | |
becanromain | 0:cf6b1eca3e67 | 68 | |
becanromain | 0:cf6b1eca3e67 | 69 | int CalcFmPuls; |
becanromain | 0:cf6b1eca3e67 | 70 | int CalcFdPuls; |
becanromain | 0:cf6b1eca3e67 | 71 | bool FmCPTPuls; |
becanromain | 0:cf6b1eca3e67 | 72 | uint64_t TimerPuls=0; |
becanromain | 0:cf6b1eca3e67 | 73 | uint64_t TpsPuls=0; |
becanromain | 0:cf6b1eca3e67 | 74 | float Calcul=0; |
becanromain | 0:cf6b1eca3e67 | 75 | uint64_t MemTpsPuls=0; |
becanromain | 0:cf6b1eca3e67 | 76 | uint64_t MemTps16Puls=0; |
becanromain | 0:cf6b1eca3e67 | 77 | int NumDent=0; |
becanromain | 0:cf6b1eca3e67 | 78 | uint64_t CptPuls=0; |
becanromain | 0:cf6b1eca3e67 | 79 | uint64_t CalcDebit=0; |
becanromain | 0:cf6b1eca3e67 | 80 | float Debit; |
becanromain | 0:cf6b1eca3e67 | 81 | float TpsEntre2Puls[20]; |
becanromain | 0:cf6b1eca3e67 | 82 | float TpsMinEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 83 | float TpsMaxEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 84 | float Volume; |
becanromain | 0:cf6b1eca3e67 | 85 | float VolParTour=1200;//en ml |
becanromain | 0:cf6b1eca3e67 | 86 | |
becanromain | 0:cf6b1eca3e67 | 87 | int hres = 480; |
becanromain | 0:cf6b1eca3e67 | 88 | int vres = 272; |
becanromain | 4:6a3d12663549 | 89 | bool CDA_POMPE; |
becanromain | 0:cf6b1eca3e67 | 90 | |
becanromain | 0:cf6b1eca3e67 | 91 | |
becanromain | 0:cf6b1eca3e67 | 92 | uint64_t test=0; |
becanromain | 0:cf6b1eca3e67 | 93 | |
becanromain | 0:cf6b1eca3e67 | 94 | //VARIABLES GESTION MOT DE PASSE |
becanromain | 0:cf6b1eca3e67 | 95 | |
becanromain | 0:cf6b1eca3e67 | 96 | |
becanromain | 0:cf6b1eca3e67 | 97 | /********************* |
becanromain | 0:cf6b1eca3e67 | 98 | * OBJET PAGES |
becanromain | 0:cf6b1eca3e67 | 99 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 100 | static lv_obj_t * BandeauHaut; |
becanromain | 0:cf6b1eca3e67 | 101 | static void AFFBandeauHaut(int Num); |
becanromain | 0:cf6b1eca3e67 | 102 | static lv_obj_t * SousMenu; |
becanromain | 0:cf6b1eca3e67 | 103 | static void AFFSousMenu(int Num); |
becanromain | 0:cf6b1eca3e67 | 104 | static lv_obj_t * Page; |
becanromain | 4:6a3d12663549 | 105 | int PageAff=0; |
becanromain | 4:6a3d12663549 | 106 | int MemPageAff=0; |
becanromain | 0:cf6b1eca3e67 | 107 | static void AFFPage(int Num); |
becanromain | 0:cf6b1eca3e67 | 108 | |
becanromain | 4:6a3d12663549 | 109 | |
becanromain | 0:cf6b1eca3e67 | 110 | static lv_obj_t * PopupMDP; |
becanromain | 0:cf6b1eca3e67 | 111 | static void AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 112 | |
becanromain | 0:cf6b1eca3e67 | 113 | static void init_all_themes(uint16_t hue); |
becanromain | 0:cf6b1eca3e67 | 114 | |
becanromain | 0:cf6b1eca3e67 | 115 | /********************* |
becanromain | 0:cf6b1eca3e67 | 116 | * OBJET GENERAUX |
becanromain | 0:cf6b1eca3e67 | 117 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 118 | static lv_obj_t *mbox; |
becanromain | 0:cf6b1eca3e67 | 119 | |
becanromain | 0:cf6b1eca3e67 | 120 | /***************************** |
becanromain | 0:cf6b1eca3e67 | 121 | * VARIABLES/OBJETS CONNEXION |
becanromain | 0:cf6b1eca3e67 | 122 | *****************************/ |
becanromain | 0:cf6b1eca3e67 | 123 | static lv_obj_t * SelectID; |
becanromain | 0:cf6b1eca3e67 | 124 | static lv_obj_t * MDP; |
becanromain | 0:cf6b1eca3e67 | 125 | static void SelectID_ACT(lv_obj_t * obj, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 126 | uint32_t TpsMdpEnCours=0; |
becanromain | 0:cf6b1eca3e67 | 127 | struct Personne |
becanromain | 0:cf6b1eca3e67 | 128 | { |
becanromain | 0:cf6b1eca3e67 | 129 | string Nom; |
becanromain | 0:cf6b1eca3e67 | 130 | string MDP; //mot de passe à 4 chiffres |
becanromain | 0:cf6b1eca3e67 | 131 | int Niveau; //0:aucun 1:Opérateur 2:superviseur 3:constructeur |
becanromain | 0:cf6b1eca3e67 | 132 | int Tps; //Temps de connexion |
becanromain | 0:cf6b1eca3e67 | 133 | }; |
becanromain | 0:cf6b1eca3e67 | 134 | Personne User[100]; |
becanromain | 0:cf6b1eca3e67 | 135 | Personne UserEC; |
becanromain | 0:cf6b1eca3e67 | 136 | static void BpValidMDP_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 137 | static void BpAnnulMDP_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 138 | static void mboxMdp_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 139 | static void mboxMdp_ACT2(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 140 | |
becanromain | 0:cf6b1eca3e67 | 141 | /********************* |
becanromain | 0:cf6b1eca3e67 | 142 | * OBJETS BP MENU |
becanromain | 0:cf6b1eca3e67 | 143 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 144 | static lv_obj_t * M100; |
becanromain | 0:cf6b1eca3e67 | 145 | static lv_obj_t * M200; |
becanromain | 0:cf6b1eca3e67 | 146 | static lv_obj_t * M300; |
becanromain | 0:cf6b1eca3e67 | 147 | static lv_obj_t * M400; |
becanromain | 0:cf6b1eca3e67 | 148 | static lv_obj_t * M500; |
becanromain | 0:cf6b1eca3e67 | 149 | static lv_obj_t * M600; |
becanromain | 0:cf6b1eca3e67 | 150 | |
becanromain | 0:cf6b1eca3e67 | 151 | static lv_obj_t * SM101; |
becanromain | 0:cf6b1eca3e67 | 152 | static lv_obj_t * SM102; |
becanromain | 0:cf6b1eca3e67 | 153 | static lv_obj_t * SM103; |
becanromain | 0:cf6b1eca3e67 | 154 | static lv_obj_t * SM104; |
becanromain | 0:cf6b1eca3e67 | 155 | static lv_obj_t * SM105; |
becanromain | 0:cf6b1eca3e67 | 156 | |
becanromain | 0:cf6b1eca3e67 | 157 | static lv_obj_t * SM201; |
becanromain | 0:cf6b1eca3e67 | 158 | static lv_obj_t * SM202; |
becanromain | 4:6a3d12663549 | 159 | |
becanromain | 4:6a3d12663549 | 160 | static lv_obj_t * SM301; |
becanromain | 0:cf6b1eca3e67 | 161 | |
becanromain | 0:cf6b1eca3e67 | 162 | //FONCTIONS ASSOCIEES |
becanromain | 0:cf6b1eca3e67 | 163 | static void M100_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 164 | static void M200_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 165 | static void M300_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 166 | static void M400_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 167 | static void M500_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 168 | static void M600_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 169 | |
becanromain | 0:cf6b1eca3e67 | 170 | static void SM101_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 171 | static void SM102_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 172 | static void SM103_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 173 | static void SM104_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 174 | static void SM105_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 175 | |
becanromain | 0:cf6b1eca3e67 | 176 | static void SM201_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 177 | static void SM202_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 178 | static void SM203_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 4:6a3d12663549 | 179 | |
becanromain | 4:6a3d12663549 | 180 | static void SM301_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 181 | |
becanromain | 0:cf6b1eca3e67 | 182 | /********************* |
becanromain | 0:cf6b1eca3e67 | 183 | * OBJETS |
becanromain | 0:cf6b1eca3e67 | 184 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 185 | static lv_obj_t *FondGris ; |
becanromain | 0:cf6b1eca3e67 | 186 | static lv_obj_t *FondGris2 ; |
becanromain | 0:cf6b1eca3e67 | 187 | |
becanromain | 0:cf6b1eca3e67 | 188 | /********************* |
becanromain | 0:cf6b1eca3e67 | 189 | * MATRICE DE BOUTONS |
becanromain | 0:cf6b1eca3e67 | 190 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 191 | static const char * PAVE_NUMERIQUE_MAP[] = {"7", "8", "9","\n", |
becanromain | 0:cf6b1eca3e67 | 192 | "4", "5","6", "\n", |
becanromain | 0:cf6b1eca3e67 | 193 | "1", "2", "3","\n", |
becanromain | 0:cf6b1eca3e67 | 194 | "0", LV_SYMBOL_BACKSPACE, ""}; |
becanromain | 0:cf6b1eca3e67 | 195 | /********************* |
becanromain | 0:cf6b1eca3e67 | 196 | * STYLES |
becanromain | 0:cf6b1eca3e67 | 197 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 198 | static lv_style_t Style_texte1; |
becanromain | 0:cf6b1eca3e67 | 199 | static lv_style_t Style_texte2; |
becanromain | 0:cf6b1eca3e67 | 200 | static lv_style_t Style_BPM; |
becanromain | 0:cf6b1eca3e67 | 201 | static lv_style_t Style_BPSM; |
becanromain | 0:cf6b1eca3e67 | 202 | static lv_style_t Style_BPSMInactif; |
becanromain | 0:cf6b1eca3e67 | 203 | static lv_style_t Style_BP; |
becanromain | 0:cf6b1eca3e67 | 204 | |
becanromain | 4:6a3d12663549 | 205 | /********************* |
becanromain | 4:6a3d12663549 | 206 | * MULTILANGUE |
becanromain | 4:6a3d12663549 | 207 | *********************/ |
becanromain | 4:6a3d12663549 | 208 | int Langue=1; |
becanromain | 4:6a3d12663549 | 209 | static void LANGUE_FR_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 4:6a3d12663549 | 210 | static void LANGUE_EN_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 211 | |
becanromain | 0:cf6b1eca3e67 | 212 | /********************* |
becanromain | 0:cf6b1eca3e67 | 213 | * FONCTION |
becanromain | 0:cf6b1eca3e67 | 214 | *********************/ |
becanromain | 0:cf6b1eca3e67 | 215 | void initialisation(); |
becanromain | 0:cf6b1eca3e67 | 216 | void interruptCompteur(); |
becanromain | 0:cf6b1eca3e67 | 217 | |
becanromain | 0:cf6b1eca3e67 | 218 | static void BPRAZ_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 4:6a3d12663549 | 219 | static void BPPOMPE_ACT(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 220 | static lv_theme_t * th_act; |
becanromain | 0:cf6b1eca3e67 | 221 | static lv_obj_t * label; |
becanromain | 0:cf6b1eca3e67 | 222 | static lv_obj_t * label1; |
becanromain | 0:cf6b1eca3e67 | 223 | |
becanromain | 0:cf6b1eca3e67 | 224 | |
becanromain | 0:cf6b1eca3e67 | 225 | static lv_obj_t * AffTensionBat; |
becanromain | 0:cf6b1eca3e67 | 226 | static lv_obj_t * AffTpsCy; |
becanromain | 0:cf6b1eca3e67 | 227 | static lv_obj_t * AffCptPuls; |
becanromain | 0:cf6b1eca3e67 | 228 | static lv_obj_t * AffDebit; |
becanromain | 0:cf6b1eca3e67 | 229 | static lv_obj_t * Aff1TpsEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 230 | static lv_obj_t * Aff2TpsEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 231 | static lv_obj_t * AffTpsMinEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 232 | static lv_obj_t * AffTpsMaxEntre2Puls; |
becanromain | 0:cf6b1eca3e67 | 233 | static lv_obj_t * AffVolume; |
becanromain | 0:cf6b1eca3e67 | 234 | static lv_obj_t * BPRAZ; |
becanromain | 4:6a3d12663549 | 235 | static lv_obj_t * BPPOMPE; |
becanromain | 0:cf6b1eca3e67 | 236 | |
becanromain | 4:6a3d12663549 | 237 | int NumSousMenu=1; |
becanromain | 0:cf6b1eca3e67 | 238 | |
becanromain | 0:cf6b1eca3e67 | 239 | LV_FONT_DECLARE(arial_20) //Declare a font |
becanromain | 0:cf6b1eca3e67 | 240 | |
becanromain | 0:cf6b1eca3e67 | 241 | void lv_ticker_func(); |
becanromain | 0:cf6b1eca3e67 | 242 | void my_disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p); |
becanromain | 0:cf6b1eca3e67 | 243 | bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); |
becanromain | 0:cf6b1eca3e67 | 244 | static void event_handler(lv_obj_t * obj, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 245 | //void btn_event_cb(lv_obj_t * btn, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 246 | |
becanromain | 0:cf6b1eca3e67 | 247 | |
becanromain | 0:cf6b1eca3e67 | 248 | |
becanromain | 0:cf6b1eca3e67 | 249 | static void ddlist_event_cb(lv_obj_t * ddlist, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 250 | static lv_obj_t * slider; |
becanromain | 0:cf6b1eca3e67 | 251 | |
becanromain | 0:cf6b1eca3e67 | 252 | int PosX_MenuDepart = 0; |
becanromain | 0:cf6b1eca3e67 | 253 | int PosX_MenuCible = 0; |
becanromain | 0:cf6b1eca3e67 | 254 | bool DdeAlignMenu = 0; |
becanromain | 0:cf6b1eca3e67 | 255 | |
becanromain | 0:cf6b1eca3e67 | 256 | int PosY_AnimSousMenu = 0; |
becanromain | 0:cf6b1eca3e67 | 257 | int AnimSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 258 | int TpsAvFermSousMenu=2000; |
becanromain | 0:cf6b1eca3e67 | 259 | |
becanromain | 0:cf6b1eca3e67 | 260 | static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event); |
becanromain | 0:cf6b1eca3e67 | 261 | |
becanromain | 0:cf6b1eca3e67 | 262 | int TestAff = 0; |
becanromain | 0:cf6b1eca3e67 | 263 | |
becanromain | 0:cf6b1eca3e67 | 264 | |
becanromain | 0:cf6b1eca3e67 | 265 | static lv_obj_t * Val_R; |
becanromain | 0:cf6b1eca3e67 | 266 | |
becanromain | 0:cf6b1eca3e67 | 267 | static lv_obj_t * R; |
becanromain | 0:cf6b1eca3e67 | 268 | |
becanromain | 0:cf6b1eca3e67 | 269 | |
becanromain | 0:cf6b1eca3e67 | 270 | int Reglage_R; |
becanromain | 0:cf6b1eca3e67 | 271 | uint8_t Reglage_G; |
becanromain | 0:cf6b1eca3e67 | 272 | uint8_t Reglage_B; |
becanromain | 0:cf6b1eca3e67 | 273 | uint32_t Reglage_RGB; |
becanromain | 0:cf6b1eca3e67 | 274 | |
becanromain | 0:cf6b1eca3e67 | 275 | |
becanromain | 0:cf6b1eca3e67 | 276 | uint8_t R1=255,G1=255,B1=255, |
becanromain | 0:cf6b1eca3e67 | 277 | R2=0 ,G2=0 ,B2=0, |
becanromain | 0:cf6b1eca3e67 | 278 | R3=255 ,G3=255 ,B3=255, |
becanromain | 0:cf6b1eca3e67 | 279 | R4=0,G4=0,B4=0, |
becanromain | 0:cf6b1eca3e67 | 280 | R5=145,G5=145,B5=145, |
becanromain | 0:cf6b1eca3e67 | 281 | R6=255,G6=255,B6=255, |
becanromain | 0:cf6b1eca3e67 | 282 | R7=0,G7=0,B7=0, |
becanromain | 0:cf6b1eca3e67 | 283 | R8=73,G8=143,B8=64, |
becanromain | 0:cf6b1eca3e67 | 284 | R9=0,G9=255,B9=0, |
becanromain | 0:cf6b1eca3e67 | 285 | R10=155,G10=238,B10=131, |
becanromain | 0:cf6b1eca3e67 | 286 | R11=145,G11=145,B11=145, |
becanromain | 0:cf6b1eca3e67 | 287 | R12=51,G12=37,B12=22, |
becanromain | 0:cf6b1eca3e67 | 288 | R13=255,G13=255,B13=255, |
becanromain | 0:cf6b1eca3e67 | 289 | R14=153,G14=158,B14=117, |
becanromain | 0:cf6b1eca3e67 | 290 | R15=107,G15=154,B15=199, |
becanromain | 0:cf6b1eca3e67 | 291 | R16=107,G16=154,B16=199, |
becanromain | 0:cf6b1eca3e67 | 292 | R17=107,G17=154,B17=199, |
becanromain | 0:cf6b1eca3e67 | 293 | R18=107,G18=154,B18=199, |
becanromain | 0:cf6b1eca3e67 | 294 | R19=107,G19=154,B19=199; |
becanromain | 0:cf6b1eca3e67 | 295 | |
becanromain | 0:cf6b1eca3e67 | 296 | |
becanromain | 0:cf6b1eca3e67 | 297 | int NumCouleur=0; |
becanromain | 0:cf6b1eca3e67 | 298 | |
becanromain | 0:cf6b1eca3e67 | 299 | |
becanromain | 0:cf6b1eca3e67 | 300 | static lv_theme_t * themes[8]; |
becanromain | 0:cf6b1eca3e67 | 301 | |
becanromain | 0:cf6b1eca3e67 | 302 | |
becanromain | 0:cf6b1eca3e67 | 303 | int main() |
becanromain | 0:cf6b1eca3e67 | 304 | { |
becanromain | 0:cf6b1eca3e67 | 305 | //demarrage communication avec PC |
becanromain | 0:cf6b1eca3e67 | 306 | serial.baud(9600); |
becanromain | 0:cf6b1eca3e67 | 307 | serial.printf("DEBUT DE PROGRAMME\r\n"); |
becanromain | 0:cf6b1eca3e67 | 308 | //Entree impulsion |
becanromain | 0:cf6b1eca3e67 | 309 | DI_CPTPuls.mode(PullUp); |
becanromain | 0:cf6b1eca3e67 | 310 | |
becanromain | 0:cf6b1eca3e67 | 311 | //lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"LittlevGL DEMO", CENTER_MODE); |
becanromain | 0:cf6b1eca3e67 | 312 | ticker.attach(&lv_ticker_func,0.005);// Appel de la fonction LittlVGL toutes les 5ms |
becanromain | 0:cf6b1eca3e67 | 313 | wait(0.5); |
becanromain | 0:cf6b1eca3e67 | 314 | lv_init(); //Initialize the LittlevGL |
becanromain | 0:cf6b1eca3e67 | 315 | |
becanromain | 0:cf6b1eca3e67 | 316 | static lv_disp_buf_t disp_buf; |
becanromain | 0:cf6b1eca3e67 | 317 | static lv_color_t buf[LV_HOR_RES_MAX * 10]; //Declare a buffer for 10 lines |
becanromain | 0:cf6b1eca3e67 | 318 | lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); //Initialize the display buffer |
becanromain | 0:cf6b1eca3e67 | 319 | |
becanromain | 0:cf6b1eca3e67 | 320 | //Implement and register a function which can copy a pixel array to an area of your display |
becanromain | 0:cf6b1eca3e67 | 321 | lv_disp_drv_t disp_drv; //Descriptor of a display driver |
becanromain | 0:cf6b1eca3e67 | 322 | lv_disp_drv_init(&disp_drv); //Basic initialization |
becanromain | 0:cf6b1eca3e67 | 323 | disp_drv.flush_cb = my_disp_flush; //Set your driver function |
becanromain | 0:cf6b1eca3e67 | 324 | disp_drv.buffer = &disp_buf; //Assign the buffer to the display |
becanromain | 0:cf6b1eca3e67 | 325 | lv_disp_drv_register(&disp_drv); //Finally register the driver |
becanromain | 0:cf6b1eca3e67 | 326 | |
becanromain | 0:cf6b1eca3e67 | 327 | //Implement and register a function which can read an input device. E.g. for a touch pad |
becanromain | 0:cf6b1eca3e67 | 328 | ts.Init(lcd.GetXSize(), lcd.GetYSize()); //ST touch initialization |
becanromain | 0:cf6b1eca3e67 | 329 | lv_indev_drv_t indev_drv; //Descriptor of a input device driver |
becanromain | 0:cf6b1eca3e67 | 330 | lv_indev_drv_init(&indev_drv); //Basic initialization |
becanromain | 0:cf6b1eca3e67 | 331 | indev_drv.type = LV_INDEV_TYPE_POINTER; //Touch pad is a pointer-like device |
becanromain | 0:cf6b1eca3e67 | 332 | indev_drv.read_cb = my_touchpad_read; //Set your driver function |
becanromain | 0:cf6b1eca3e67 | 333 | lv_indev_drv_register(&indev_drv); //Finally register the driver |
becanromain | 0:cf6b1eca3e67 | 334 | |
becanromain | 4:6a3d12663549 | 335 | //INITIALISATION MULTILANGUE |
becanromain | 4:6a3d12663549 | 336 | lv_i18n_init(lv_i18n_language_pack); |
becanromain | 4:6a3d12663549 | 337 | lv_i18n_set_locale("fr"); |
kisvegabor | 5:cab3e2179cbf | 338 | //lv_i18n_set_locale("en-GB"); |
becanromain | 0:cf6b1eca3e67 | 339 | |
becanromain | 0:cf6b1eca3e67 | 340 | initialisation(); |
becanromain | 0:cf6b1eca3e67 | 341 | AFFBandeauHaut(0); |
becanromain | 4:6a3d12663549 | 342 | AFFPage(101); |
becanromain | 0:cf6b1eca3e67 | 343 | |
becanromain | 0:cf6b1eca3e67 | 344 | //demarrage tempo générale |
becanromain | 0:cf6b1eca3e67 | 345 | tempo.start(); |
becanromain | 0:cf6b1eca3e67 | 346 | //Interruption compteur |
becanromain | 0:cf6b1eca3e67 | 347 | // DI_CPTPuls.rise(&interruptCompteur); |
becanromain | 0:cf6b1eca3e67 | 348 | |
becanromain | 0:cf6b1eca3e67 | 349 | while(1) { |
becanromain | 0:cf6b1eca3e67 | 350 | |
becanromain | 0:cf6b1eca3e67 | 351 | //TEMPO GENERALE |
becanromain | 0:cf6b1eca3e67 | 352 | Micros=tempo.read_high_resolution_us(); |
becanromain | 0:cf6b1eca3e67 | 353 | //TOP base de temps |
becanromain | 0:cf6b1eca3e67 | 354 | Top1ms=false; if (Micros>=MemMicros0+1000) { Top1ms=true; MemMicros0=MemMicros0+1000; } |
becanromain | 0:cf6b1eca3e67 | 355 | Top10ms=false; if (Micros>=MemMicros1+10000) { Top10ms=true; MemMicros1=MemMicros1+10000; } |
becanromain | 0:cf6b1eca3e67 | 356 | Top100ms=false; if (Micros>=MemMicros2+100000) { Top100ms=true; MemMicros2=MemMicros2+100000; } |
becanromain | 0:cf6b1eca3e67 | 357 | Top1s=false; if (Micros>=MemMicros3+1000000) { Top1s=true; MemMicros3=MemMicros3+1000000; } |
becanromain | 0:cf6b1eca3e67 | 358 | Top5s=false; if (Micros>=MemMicros4+5000000) { Top5s=true; MemMicros4=MemMicros4+5000000; } |
becanromain | 0:cf6b1eca3e67 | 359 | Top1min=false; if (Micros>=MemMicros5+60000000) { Top1min=true; MemMicros5=MemMicros5+60000000; } |
becanromain | 0:cf6b1eca3e67 | 360 | |
becanromain | 0:cf6b1eca3e67 | 361 | //CALCUL TEMPS DE CYCLE |
becanromain | 0:cf6b1eca3e67 | 362 | CalcTpsCy++; |
becanromain | 0:cf6b1eca3e67 | 363 | if (Top1s){ |
becanromain | 0:cf6b1eca3e67 | 364 | TpsCy=1000000000/CalcTpsCy; |
becanromain | 0:cf6b1eca3e67 | 365 | TpsCy=TpsCy/1000; |
becanromain | 0:cf6b1eca3e67 | 366 | test=CalcTpsCy; |
becanromain | 4:6a3d12663549 | 367 | CalcTpsCy=0; |
becanromain | 0:cf6b1eca3e67 | 368 | } |
becanromain | 0:cf6b1eca3e67 | 369 | //Raffraichissement affichage toutes les 10ms |
becanromain | 0:cf6b1eca3e67 | 370 | if (Top10ms){ |
becanromain | 0:cf6b1eca3e67 | 371 | lv_task_handler(); |
becanromain | 0:cf6b1eca3e67 | 372 | } |
becanromain | 4:6a3d12663549 | 373 | |
becanromain | 0:cf6b1eca3e67 | 374 | //MISE A JOUR DES VARIABLES AFFICHEES |
becanromain | 4:6a3d12663549 | 375 | if (Top1s or MemPageAff!=PageAff){ |
becanromain | 4:6a3d12663549 | 376 | MemPageAff=PageAff; |
becanromain | 4:6a3d12663549 | 377 | if (PageAff==101){ |
becanromain | 4:6a3d12663549 | 378 | sprintf(text, _("Temps de cycle = %3.3f us"),TpsCy); lv_label_set_text(AffTpsCy, text); |
becanromain | 4:6a3d12663549 | 379 | sprintf(text, _("Tension= %3.3f V "),TensionBat ); lv_label_set_text(AffTensionBat, text); |
becanromain | 4:6a3d12663549 | 380 | sprintf(text, "Nombre d'impulsion= %d ",CptPuls ); lv_label_set_text(AffCptPuls, text); |
becanromain | 4:6a3d12663549 | 381 | sprintf(text, "Volume = %3.3f L",Volume ); lv_label_set_text(AffVolume, text); |
becanromain | 4:6a3d12663549 | 382 | sprintf(text, "Debit= %3.3f L/min ",Debit ); lv_label_set_text(AffDebit, text); |
becanromain | 4:6a3d12663549 | 383 | 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 | 4:6a3d12663549 | 384 | 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 | 4:6a3d12663549 | 385 | sprintf(text, "Temps mini entre 2 impulsions = %d ",Micros ); lv_label_set_text(AffTpsMinEntre2Puls, text); |
becanromain | 4:6a3d12663549 | 386 | sprintf(text, "Temps maxi entre 2 impulsions = %d",test ); lv_label_set_text(AffTpsMaxEntre2Puls, text); |
becanromain | 4:6a3d12663549 | 387 | } |
becanromain | 4:6a3d12663549 | 388 | if (PageAff==301){ |
becanromain | 4:6a3d12663549 | 389 | |
becanromain | 4:6a3d12663549 | 390 | } |
becanromain | 4:6a3d12663549 | 391 | |
becanromain | 0:cf6b1eca3e67 | 392 | } |
becanromain | 0:cf6b1eca3e67 | 393 | |
becanromain | 0:cf6b1eca3e67 | 394 | //DETECTION IMPULSION |
becanromain | 0:cf6b1eca3e67 | 395 | if (DI_CPTPuls and Top1ms){ CalcFdPuls=0;CalcFmPuls++;} |
becanromain | 0:cf6b1eca3e67 | 396 | if (not DI_CPTPuls and Top1ms){ CalcFmPuls=0;CalcFdPuls++;} |
becanromain | 0:cf6b1eca3e67 | 397 | if (CalcFmPuls>20 and not FmCPTPuls){interruptCompteur();FmCPTPuls=true;} |
becanromain | 0:cf6b1eca3e67 | 398 | if (CalcFdPuls>20 and FmCPTPuls){FmCPTPuls=false;} |
becanromain | 0:cf6b1eca3e67 | 399 | if (CalcFmPuls>500){CalcFmPuls=500;} |
becanromain | 0:cf6b1eca3e67 | 400 | if (CalcFdPuls>500){CalcFdPuls=500;} |
becanromain | 0:cf6b1eca3e67 | 401 | |
becanromain | 0:cf6b1eca3e67 | 402 | //MESURE TENSION BATTERIE |
becanromain | 0:cf6b1eca3e67 | 403 | if (Top10ms){ |
becanromain | 4:6a3d12663549 | 404 | MoyTensBat[0]=AI_TENSION_BAT.read()*3.3*2+0.018; |
becanromain | 0:cf6b1eca3e67 | 405 | TensionBat=0; |
becanromain | 0:cf6b1eca3e67 | 406 | for (int i=100;i>0;i--){ |
becanromain | 0:cf6b1eca3e67 | 407 | MoyTensBat[i]=MoyTensBat[i-1]; |
becanromain | 0:cf6b1eca3e67 | 408 | TensionBat=TensionBat+MoyTensBat[i]; |
becanromain | 0:cf6b1eca3e67 | 409 | } |
becanromain | 0:cf6b1eca3e67 | 410 | TensionBat=TensionBat/100; |
becanromain | 0:cf6b1eca3e67 | 411 | } |
becanromain | 0:cf6b1eca3e67 | 412 | |
becanromain | 0:cf6b1eca3e67 | 413 | //COMMANDE POMPE PWM |
becanromain | 0:cf6b1eca3e67 | 414 | if (Top100ms){ |
becanromain | 0:cf6b1eca3e67 | 415 | CsgPompe=Reglage_R; |
becanromain | 0:cf6b1eca3e67 | 416 | fastpwm.period_ticks (10000); //setup the period for 100Khz |
becanromain | 0:cf6b1eca3e67 | 417 | fastpwm.pulsewidth_ticks(CsgPompe);//setup duty cycle to 50% |
becanromain | 0:cf6b1eca3e67 | 418 | } |
becanromain | 4:6a3d12663549 | 419 | |
becanromain | 0:cf6b1eca3e67 | 420 | //RAZ MOT DE PASSE |
becanromain | 0:cf6b1eca3e67 | 421 | if (TpsMdpEnCours>0 and Top1s){ |
becanromain | 0:cf6b1eca3e67 | 422 | TpsMdpEnCours--; |
becanromain | 0:cf6b1eca3e67 | 423 | if (TpsMdpEnCours==0){ |
becanromain | 0:cf6b1eca3e67 | 424 | mbox=lv_mbox_create(lv_disp_get_scr_act(NULL), NULL); |
becanromain | 0:cf6b1eca3e67 | 425 | sprintf(text, "Fin de connexion pour %s",UserEC.Nom ); |
becanromain | 0:cf6b1eca3e67 | 426 | lv_mbox_set_text(mbox, text); |
becanromain | 0:cf6b1eca3e67 | 427 | lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 428 | lv_mbox_start_auto_close(mbox, 3000); |
becanromain | 0:cf6b1eca3e67 | 429 | UserEC.Nom=""; |
becanromain | 0:cf6b1eca3e67 | 430 | UserEC.Niveau=0; |
becanromain | 0:cf6b1eca3e67 | 431 | } |
becanromain | 0:cf6b1eca3e67 | 432 | } |
becanromain | 0:cf6b1eca3e67 | 433 | |
becanromain | 0:cf6b1eca3e67 | 434 | //ANIMATION MENU |
becanromain | 0:cf6b1eca3e67 | 435 | if (Top1ms){ |
becanromain | 0:cf6b1eca3e67 | 436 | if (DdeAlignMenu) { |
becanromain | 0:cf6b1eca3e67 | 437 | if (PosX_MenuDepart>PosX_MenuCible) { |
becanromain | 0:cf6b1eca3e67 | 438 | PosX_MenuDepart=PosX_MenuDepart-1; |
becanromain | 0:cf6b1eca3e67 | 439 | lv_obj_set_pos(BandeauHaut, PosX_MenuDepart, 0); |
becanromain | 0:cf6b1eca3e67 | 440 | } |
becanromain | 0:cf6b1eca3e67 | 441 | if (PosX_MenuDepart<PosX_MenuCible) { |
becanromain | 0:cf6b1eca3e67 | 442 | PosX_MenuDepart=PosX_MenuDepart+1; |
becanromain | 0:cf6b1eca3e67 | 443 | lv_obj_set_pos(BandeauHaut, PosX_MenuDepart, 0); |
becanromain | 0:cf6b1eca3e67 | 444 | } |
becanromain | 0:cf6b1eca3e67 | 445 | if (PosX_MenuDepart==PosX_MenuCible) { |
becanromain | 0:cf6b1eca3e67 | 446 | DdeAlignMenu=0; |
becanromain | 0:cf6b1eca3e67 | 447 | AFFSousMenu(NumSousMenu);//affichage page sous menu |
becanromain | 0:cf6b1eca3e67 | 448 | } |
becanromain | 0:cf6b1eca3e67 | 449 | } |
becanromain | 0:cf6b1eca3e67 | 450 | } |
becanromain | 0:cf6b1eca3e67 | 451 | |
becanromain | 0:cf6b1eca3e67 | 452 | //ANIMATION SOUS MENU |
becanromain | 0:cf6b1eca3e67 | 453 | if (Top1ms){ |
becanromain | 0:cf6b1eca3e67 | 454 | |
becanromain | 0:cf6b1eca3e67 | 455 | //OUVERTURE SOUS MENU |
becanromain | 0:cf6b1eca3e67 | 456 | if (AnimSousMenu>0) { |
becanromain | 0:cf6b1eca3e67 | 457 | PosY_AnimSousMenu=PosY_AnimSousMenu+2; |
becanromain | 0:cf6b1eca3e67 | 458 | lv_obj_set_size(SousMenu, 100, PosY_AnimSousMenu); |
becanromain | 0:cf6b1eca3e67 | 459 | if (PosY_AnimSousMenu>=AnimSousMenu){AnimSousMenu=0;} |
kisvegabor | 1:404ee28a0b60 | 460 | TpsAvFermSousMenu=4000; |
becanromain | 0:cf6b1eca3e67 | 461 | } |
becanromain | 0:cf6b1eca3e67 | 462 | //TEMPS AVANT FERMEURE |
kisvegabor | 1:404ee28a0b60 | 463 | if (SousMenu and TpsAvFermSousMenu>0){TpsAvFermSousMenu--;} |
becanromain | 0:cf6b1eca3e67 | 464 | //FERMETURE SOUS MENU |
kisvegabor | 1:404ee28a0b60 | 465 | if (SousMenu and TpsAvFermSousMenu<=0) { |
becanromain | 0:cf6b1eca3e67 | 466 | PosY_AnimSousMenu=PosY_AnimSousMenu-2; |
becanromain | 0:cf6b1eca3e67 | 467 | lv_obj_set_size(SousMenu, 100, PosY_AnimSousMenu); |
kisvegabor | 1:404ee28a0b60 | 468 | if (PosY_AnimSousMenu<=0){ |
kisvegabor | 1:404ee28a0b60 | 469 | lv_obj_del_async(SousMenu); |
kisvegabor | 1:404ee28a0b60 | 470 | SousMenu=NULL; |
kisvegabor | 1:404ee28a0b60 | 471 | } |
becanromain | 0:cf6b1eca3e67 | 472 | } |
becanromain | 0:cf6b1eca3e67 | 473 | } |
kisvegabor | 1:404ee28a0b60 | 474 | if (SousMenu and X>0){TpsAvFermSousMenu=4000;} |
becanromain | 0:cf6b1eca3e67 | 475 | |
becanromain | 0:cf6b1eca3e67 | 476 | /**/ |
becanromain | 0:cf6b1eca3e67 | 477 | }//FIN BOUCLE |
becanromain | 0:cf6b1eca3e67 | 478 | }//FIN MAIN |
becanromain | 0:cf6b1eca3e67 | 479 | |
becanromain | 0:cf6b1eca3e67 | 480 | |
becanromain | 0:cf6b1eca3e67 | 481 | //FONCTION INTERRUPTION COMPTEUR D'IMPULSION |
becanromain | 0:cf6b1eca3e67 | 482 | void interruptCompteur() |
becanromain | 0:cf6b1eca3e67 | 483 | { |
becanromain | 0:cf6b1eca3e67 | 484 | //Timestamp pulsation |
becanromain | 0:cf6b1eca3e67 | 485 | TimerPuls=tempo.read_high_resolution_us(); |
becanromain | 0:cf6b1eca3e67 | 486 | |
becanromain | 0:cf6b1eca3e67 | 487 | // Calcul temps entre 2 impulsions |
becanromain | 0:cf6b1eca3e67 | 488 | TpsPuls=TimerPuls-MemTpsPuls; |
becanromain | 0:cf6b1eca3e67 | 489 | MemTpsPuls=TimerPuls; |
becanromain | 0:cf6b1eca3e67 | 490 | |
becanromain | 0:cf6b1eca3e67 | 491 | //Incrementation numéro de dent roue |
becanromain | 0:cf6b1eca3e67 | 492 | NumDent++; |
becanromain | 0:cf6b1eca3e67 | 493 | |
becanromain | 0:cf6b1eca3e67 | 494 | //Memorisation ecart entre chaque impulsion et Calcul des Min Max |
becanromain | 0:cf6b1eca3e67 | 495 | Calcul=TpsPuls; |
becanromain | 0:cf6b1eca3e67 | 496 | Calcul=Calcul/1000; |
becanromain | 0:cf6b1eca3e67 | 497 | TpsEntre2Puls[NumDent]=Calcul; |
becanromain | 0:cf6b1eca3e67 | 498 | if (Calcul<TpsMinEntre2Puls){TpsMinEntre2Puls=Calcul;} |
becanromain | 0:cf6b1eca3e67 | 499 | if (Calcul>TpsMaxEntre2Puls){TpsMaxEntre2Puls=Calcul;} |
becanromain | 0:cf6b1eca3e67 | 500 | |
becanromain | 0:cf6b1eca3e67 | 501 | //Calcul débit |
becanromain | 0:cf6b1eca3e67 | 502 | if (NumDent>=16){ |
becanromain | 0:cf6b1eca3e67 | 503 | CalcDebit=VolParTour; |
becanromain | 0:cf6b1eca3e67 | 504 | CalcDebit=60000000*CalcDebit/(TimerPuls-MemTps16Puls); |
becanromain | 0:cf6b1eca3e67 | 505 | Debit=CalcDebit; |
becanromain | 0:cf6b1eca3e67 | 506 | Debit=Debit/1000; |
becanromain | 0:cf6b1eca3e67 | 507 | MemTps16Puls=TimerPuls; |
becanromain | 0:cf6b1eca3e67 | 508 | NumDent=0; |
becanromain | 0:cf6b1eca3e67 | 509 | } |
becanromain | 0:cf6b1eca3e67 | 510 | |
becanromain | 0:cf6b1eca3e67 | 511 | //Nombre d'impulsion total |
becanromain | 0:cf6b1eca3e67 | 512 | CptPuls++; |
becanromain | 0:cf6b1eca3e67 | 513 | |
becanromain | 0:cf6b1eca3e67 | 514 | //Calcul Volume |
becanromain | 0:cf6b1eca3e67 | 515 | Volume=CptPuls*VolParTour/16000; |
becanromain | 0:cf6b1eca3e67 | 516 | |
becanromain | 0:cf6b1eca3e67 | 517 | } |
becanromain | 0:cf6b1eca3e67 | 518 | |
becanromain | 0:cf6b1eca3e67 | 519 | void initialisation(void) |
becanromain | 0:cf6b1eca3e67 | 520 | { |
becanromain | 4:6a3d12663549 | 521 | //CHARGEMENT DU THEME |
kisvegabor | 5:cab3e2179cbf | 522 | th_act = lv_theme_rb_init(0, &RB_lv_font_roboto_12); //Gabor: When i change something in my Theme nothing's happen. Can you see in /lvgl_RB/lv_theme_rb.c |
becanromain | 4:6a3d12663549 | 523 | // th_act = lv_theme_night_init(0, NULL); |
becanromain | 0:cf6b1eca3e67 | 524 | lv_theme_set_current(th_act); |
becanromain | 0:cf6b1eca3e67 | 525 | |
becanromain | 0:cf6b1eca3e67 | 526 | lv_obj_t * scr = lv_obj_create(NULL, NULL); |
becanromain | 0:cf6b1eca3e67 | 527 | lv_disp_load_scr(scr); |
becanromain | 4:6a3d12663549 | 528 | |
becanromain | 0:cf6b1eca3e67 | 529 | //INITIALISATION TABLEAU UTILISATEUR |
becanromain | 4:6a3d12663549 | 530 | User[1].Nom="Romain BECAN"; User[1].MDP="1234"; User[1].Niveau=3; User[1].Tps=1; |
becanromain | 0:cf6b1eca3e67 | 531 | User[2].Nom="Guy HERVE"; User[2].MDP="5678"; User[2].Niveau=2; User[2].Tps=120; |
becanromain | 0:cf6b1eca3e67 | 532 | User[31].Nom="OPERATEUR 1"; User[31].MDP="4321"; User[31].Niveau=1; User[31].Tps=1; |
becanromain | 0:cf6b1eca3e67 | 533 | User[32].Nom="OPERATEUR 2"; User[32].MDP="4321"; User[32].Niveau=1; User[32].Tps=60; |
becanromain | 0:cf6b1eca3e67 | 534 | User[33].Nom="OPERATEUR 3"; User[33].MDP="4321"; User[33].Niveau=1; User[33].Tps=40; |
becanromain | 0:cf6b1eca3e67 | 535 | User[34].Nom="OPERATEUR 4"; User[34].MDP="4321"; User[34].Niveau=1; User[34].Tps=30; |
becanromain | 0:cf6b1eca3e67 | 536 | User[35].Nom="OPERATEUR 5"; User[35].MDP="4321"; User[35].Niveau=3; User[35].Tps=30; |
becanromain | 0:cf6b1eca3e67 | 537 | User[36].Nom="OPERATEUR 6"; User[36].MDP="4321"; User[36].Niveau=3; User[36].Tps=30; |
becanromain | 0:cf6b1eca3e67 | 538 | User[99].Nom="OPERATEUR 100"; User[99].MDP="4321"; User[99].Niveau=3; User[99].Tps=30; |
becanromain | 0:cf6b1eca3e67 | 539 | } |
becanromain | 0:cf6b1eca3e67 | 540 | |
becanromain | 0:cf6b1eca3e67 | 541 | |
becanromain | 0:cf6b1eca3e67 | 542 | |
becanromain | 0:cf6b1eca3e67 | 543 | static void AFFBandeauHaut(int Num) |
becanromain | 0:cf6b1eca3e67 | 544 | { |
becanromain | 4:6a3d12663549 | 545 | if(BandeauHaut) { |
becanromain | 4:6a3d12663549 | 546 | lv_obj_del(BandeauHaut); |
becanromain | 4:6a3d12663549 | 547 | BandeauHaut = NULL; |
becanromain | 4:6a3d12663549 | 548 | } |
becanromain | 4:6a3d12663549 | 549 | |
becanromain | 4:6a3d12663549 | 550 | // CREATION OBJET BANDEAU HAUT |
becanromain | 4:6a3d12663549 | 551 | BandeauHaut = lv_cont_create(lv_scr_act(), NULL); |
becanromain | 4:6a3d12663549 | 552 | lv_obj_set_size(BandeauHaut,900,40); |
becanromain | 4:6a3d12663549 | 553 | lv_cont_set_fit2(BandeauHaut,LV_FIT_TIGHT, LV_FIT_NONE); |
becanromain | 4:6a3d12663549 | 554 | lv_obj_set_pos(BandeauHaut, 50, 0); |
becanromain | 4:6a3d12663549 | 555 | lv_obj_set_drag_dir(BandeauHaut, LV_DRAG_DIR_HOR); |
becanromain | 4:6a3d12663549 | 556 | lv_obj_set_drag_throw(BandeauHaut, true); |
becanromain | 4:6a3d12663549 | 557 | |
becanromain | 0:cf6b1eca3e67 | 558 | //MENU 1 |
becanromain | 0:cf6b1eca3e67 | 559 | M100 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 560 | lv_btn_set_ink_in_time(M100, 200); |
becanromain | 0:cf6b1eca3e67 | 561 | lv_btn_set_ink_wait_time(M100, 100); |
becanromain | 0:cf6b1eca3e67 | 562 | lv_btn_set_ink_out_time(M100, 500); |
becanromain | 0:cf6b1eca3e67 | 563 | lv_obj_t * label = lv_label_create(M100, NULL); |
becanromain | 4:6a3d12663549 | 564 | lv_label_set_text(label, _("M100")); |
becanromain | 0:cf6b1eca3e67 | 565 | lv_obj_set_size(M100,100,40); |
becanromain | 0:cf6b1eca3e67 | 566 | lv_obj_set_drag_parent(M100, true); |
becanromain | 0:cf6b1eca3e67 | 567 | lv_obj_set_event_cb(M100, M100_ACT); |
becanromain | 0:cf6b1eca3e67 | 568 | |
becanromain | 0:cf6b1eca3e67 | 569 | //MENU 2 |
becanromain | 0:cf6b1eca3e67 | 570 | M200 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 571 | lv_btn_set_ink_in_time(M200, 200); |
becanromain | 0:cf6b1eca3e67 | 572 | lv_btn_set_ink_wait_time(M200, 100); |
becanromain | 0:cf6b1eca3e67 | 573 | lv_btn_set_ink_out_time(M200, 500); |
becanromain | 0:cf6b1eca3e67 | 574 | label = lv_label_create(M200, NULL); |
becanromain | 4:6a3d12663549 | 575 | lv_label_set_text(label, _("M200")); |
becanromain | 0:cf6b1eca3e67 | 576 | lv_obj_set_size(M200,100,40); |
becanromain | 0:cf6b1eca3e67 | 577 | //lv_btn_set_toggle(M200, true); |
becanromain | 0:cf6b1eca3e67 | 578 | // lv_btn_toggle(M200); |
becanromain | 0:cf6b1eca3e67 | 579 | // lv_obj_set_drag(M200, true); |
becanromain | 0:cf6b1eca3e67 | 580 | lv_obj_align(M200, M100, LV_ALIGN_OUT_RIGHT_MID, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 581 | lv_obj_set_drag_parent(M200, true); |
becanromain | 0:cf6b1eca3e67 | 582 | lv_obj_set_event_cb(M200, M200_ACT); |
becanromain | 0:cf6b1eca3e67 | 583 | |
becanromain | 0:cf6b1eca3e67 | 584 | //MENU 3 |
becanromain | 0:cf6b1eca3e67 | 585 | M300 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 586 | label = lv_label_create(M300, NULL); |
becanromain | 4:6a3d12663549 | 587 | lv_label_set_text(label, _("M300")); |
becanromain | 0:cf6b1eca3e67 | 588 | lv_obj_set_size(M300,100,40); |
becanromain | 0:cf6b1eca3e67 | 589 | lv_obj_align(M300, M200, LV_ALIGN_OUT_RIGHT_MID, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 590 | lv_obj_set_drag_parent(M300, true); |
becanromain | 0:cf6b1eca3e67 | 591 | lv_obj_set_event_cb(M300, M300_ACT); |
becanromain | 0:cf6b1eca3e67 | 592 | |
becanromain | 0:cf6b1eca3e67 | 593 | //MENU 4 |
becanromain | 0:cf6b1eca3e67 | 594 | M400 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 595 | label = lv_label_create(M400, NULL); |
becanromain | 4:6a3d12663549 | 596 | lv_label_set_text(label, _("M400")); |
becanromain | 0:cf6b1eca3e67 | 597 | lv_obj_set_size(M400,100,40); |
becanromain | 0:cf6b1eca3e67 | 598 | lv_obj_align(M400, M300, LV_ALIGN_OUT_RIGHT_MID, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 599 | lv_obj_set_drag_parent(M400, true); |
becanromain | 0:cf6b1eca3e67 | 600 | lv_obj_set_event_cb(M400, M400_ACT); |
becanromain | 0:cf6b1eca3e67 | 601 | |
becanromain | 0:cf6b1eca3e67 | 602 | //MENU 5 |
becanromain | 0:cf6b1eca3e67 | 603 | M500 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 604 | label = lv_label_create(M500, NULL); |
becanromain | 4:6a3d12663549 | 605 | lv_label_set_text(label, _("M500")); |
becanromain | 0:cf6b1eca3e67 | 606 | lv_obj_set_size(M500,100,40); |
becanromain | 0:cf6b1eca3e67 | 607 | lv_obj_align(M500, M400, LV_ALIGN_OUT_RIGHT_MID, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 608 | lv_obj_set_drag_parent(M500, true); |
becanromain | 0:cf6b1eca3e67 | 609 | lv_obj_set_event_cb(M500, M500_ACT); |
becanromain | 0:cf6b1eca3e67 | 610 | |
becanromain | 0:cf6b1eca3e67 | 611 | //BP BPMENU6 |
becanromain | 0:cf6b1eca3e67 | 612 | M600 = lv_btn_create(BandeauHaut, NULL); |
becanromain | 0:cf6b1eca3e67 | 613 | label = lv_label_create(M600, NULL); |
becanromain | 4:6a3d12663549 | 614 | lv_label_set_text(label, _("M600")); |
becanromain | 0:cf6b1eca3e67 | 615 | lv_obj_set_size(M600,100,40); |
becanromain | 0:cf6b1eca3e67 | 616 | lv_obj_align(M600, M500, LV_ALIGN_OUT_RIGHT_MID, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 617 | lv_obj_set_drag_parent(M600, true); |
becanromain | 0:cf6b1eca3e67 | 618 | lv_obj_set_event_cb(M600, M600_ACT); |
becanromain | 0:cf6b1eca3e67 | 619 | |
becanromain | 0:cf6b1eca3e67 | 620 | } |
becanromain | 0:cf6b1eca3e67 | 621 | |
becanromain | 0:cf6b1eca3e67 | 622 | |
becanromain | 0:cf6b1eca3e67 | 623 | static void AFFSousMenu(int Num) |
becanromain | 0:cf6b1eca3e67 | 624 | { |
becanromain | 0:cf6b1eca3e67 | 625 | //SI SOUS MENU DEJA AFFICHE : SUPPRIMER PAGE AVANT CREATION NOUVELLE |
kisvegabor | 1:404ee28a0b60 | 626 | if(SousMenu) { |
kisvegabor | 1:404ee28a0b60 | 627 | lv_obj_del(SousMenu); |
kisvegabor | 1:404ee28a0b60 | 628 | SousMenu = NULL; |
kisvegabor | 1:404ee28a0b60 | 629 | } |
becanromain | 4:6a3d12663549 | 630 | |
becanromain | 0:cf6b1eca3e67 | 631 | /*Create a list*/ |
becanromain | 0:cf6b1eca3e67 | 632 | SousMenu = lv_list_create(lv_scr_act(), NULL); |
becanromain | 0:cf6b1eca3e67 | 633 | lv_obj_set_size(SousMenu, 100, 100); |
becanromain | 0:cf6b1eca3e67 | 634 | lv_obj_set_pos(SousMenu, 0, 40); |
becanromain | 0:cf6b1eca3e67 | 635 | |
becanromain | 0:cf6b1eca3e67 | 636 | lv_style_copy(&Style_BPSM, &lv_style_btn_rel); |
kisvegabor | 3:78125a86a357 | 637 | Style_BPSM.text.font = &lv_font_roboto_12; |
kisvegabor | 3:78125a86a357 | 638 | Style_BPSM.body.main_color = LV_COLOR_RED; |
kisvegabor | 3:78125a86a357 | 639 | Style_BPSM.body.padding.top = LV_DPI / 40; |
kisvegabor | 3:78125a86a357 | 640 | Style_BPSM.body.padding.bottom = LV_DPI / 40; |
becanromain | 4:6a3d12663549 | 641 | // G/ABOR: How to change the height of button in a list ? |
kisvegabor | 1:404ee28a0b60 | 642 | // ROMAIN: You need to modify the paddings. See here: https://docs.littlevgl.com/en/html/object-types/list.html#style-usage |
kisvegabor | 3:78125a86a357 | 643 | // Your intention with looked good you just need to apply it with lv_btn_set_style(SM101, LV_BTN_STYLE_REL, &Style_BPSM); |
becanromain | 0:cf6b1eca3e67 | 644 | |
becanromain | 0:cf6b1eca3e67 | 645 | //SOUS MENU 100 |
becanromain | 0:cf6b1eca3e67 | 646 | if (Num==100){ |
becanromain | 0:cf6b1eca3e67 | 647 | AnimSousMenu=200;//TAILLE FENETRE |
becanromain | 0:cf6b1eca3e67 | 648 | SM101 = lv_list_add_btn(SousMenu, NULL, "SM101"); |
kisvegabor | 3:78125a86a357 | 649 | lv_btn_set_style(SM101, LV_BTN_STYLE_REL, &Style_BPSM); |
becanromain | 4:6a3d12663549 | 650 | lv_btn_set_style(SM101, LV_BTN_STYLE_PR, &Style_BPSM); |
becanromain | 0:cf6b1eca3e67 | 651 | if (UserEC.Niveau<0){lv_btn_set_state(SM101, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 652 | lv_obj_set_event_cb(SM101, SM101_ACT); |
becanromain | 0:cf6b1eca3e67 | 653 | |
becanromain | 0:cf6b1eca3e67 | 654 | SM102 = lv_list_add_btn(SousMenu, NULL, "SM102"); |
becanromain | 0:cf6b1eca3e67 | 655 | if (UserEC.Niveau<0){lv_btn_set_state(SM102, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 656 | lv_obj_set_event_cb(SM102, SM102_ACT); |
becanromain | 0:cf6b1eca3e67 | 657 | |
becanromain | 0:cf6b1eca3e67 | 658 | SM103 = lv_list_add_btn(SousMenu, NULL, "SM103"); |
becanromain | 0:cf6b1eca3e67 | 659 | if (UserEC.Niveau<1){lv_btn_set_state(SM103, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 660 | lv_obj_set_event_cb(SM103, SM103_ACT); |
becanromain | 0:cf6b1eca3e67 | 661 | |
becanromain | 0:cf6b1eca3e67 | 662 | SM104 = lv_list_add_btn(SousMenu, NULL, "NOM DE MENU LONG"); |
becanromain | 0:cf6b1eca3e67 | 663 | if (UserEC.Niveau<0){lv_btn_set_state(SM104, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 664 | lv_obj_set_event_cb(SM104, SM104_ACT); |
becanromain | 0:cf6b1eca3e67 | 665 | |
becanromain | 0:cf6b1eca3e67 | 666 | SM105 = lv_list_add_btn(SousMenu, NULL, "SM104"); |
becanromain | 0:cf6b1eca3e67 | 667 | if (UserEC.Niveau<0){lv_btn_set_state(SM105, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 668 | lv_obj_set_event_cb(SM105, SM105_ACT); |
becanromain | 0:cf6b1eca3e67 | 669 | } |
becanromain | 0:cf6b1eca3e67 | 670 | |
becanromain | 0:cf6b1eca3e67 | 671 | //SOUS MENU 200 |
becanromain | 0:cf6b1eca3e67 | 672 | if (Num==200){ |
becanromain | 0:cf6b1eca3e67 | 673 | AnimSousMenu=100;//TAILLE FENETRE |
becanromain | 0:cf6b1eca3e67 | 674 | SM201 = lv_list_add_btn(SousMenu, NULL, "SM201"); |
becanromain | 0:cf6b1eca3e67 | 675 | if (UserEC.Niveau<0){lv_btn_set_state(SM201, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 676 | lv_obj_set_event_cb(SM201, SM201_ACT); |
becanromain | 0:cf6b1eca3e67 | 677 | |
becanromain | 0:cf6b1eca3e67 | 678 | SM202 = lv_list_add_btn(SousMenu, NULL, "SM202"); |
becanromain | 0:cf6b1eca3e67 | 679 | if (UserEC.Niveau<0){lv_btn_set_state(SM202, LV_BTN_STATE_INA );} |
becanromain | 0:cf6b1eca3e67 | 680 | lv_obj_set_event_cb(SM202, SM202_ACT); |
becanromain | 0:cf6b1eca3e67 | 681 | |
becanromain | 0:cf6b1eca3e67 | 682 | } |
becanromain | 4:6a3d12663549 | 683 | //SOUS MENU 300 |
becanromain | 4:6a3d12663549 | 684 | if (Num==300){ |
becanromain | 4:6a3d12663549 | 685 | AnimSousMenu=300;//TAILLE FENETRE |
becanromain | 4:6a3d12663549 | 686 | SM301 = lv_list_add_btn(SousMenu, NULL, _("SM301")); |
becanromain | 4:6a3d12663549 | 687 | if (UserEC.Niveau<0){lv_btn_set_state(SM301, LV_BTN_STATE_INA );} |
becanromain | 4:6a3d12663549 | 688 | lv_obj_set_event_cb(SM301, SM301_ACT); |
becanromain | 4:6a3d12663549 | 689 | } |
becanromain | 0:cf6b1eca3e67 | 690 | |
becanromain | 0:cf6b1eca3e67 | 691 | } |
becanromain | 0:cf6b1eca3e67 | 692 | |
becanromain | 0:cf6b1eca3e67 | 693 | |
becanromain | 0:cf6b1eca3e67 | 694 | static void AFFPage(int Num) |
becanromain | 0:cf6b1eca3e67 | 695 | { |
becanromain | 4:6a3d12663549 | 696 | if(Page) { |
becanromain | 4:6a3d12663549 | 697 | lv_obj_del(Page); |
becanromain | 4:6a3d12663549 | 698 | // lv_obj_clean(Page); |
becanromain | 4:6a3d12663549 | 699 | Page = NULL; |
becanromain | 4:6a3d12663549 | 700 | } |
becanromain | 4:6a3d12663549 | 701 | //MEMORISATION PAGE AFFICHEE |
becanromain | 4:6a3d12663549 | 702 | PageAff=Num; |
becanromain | 4:6a3d12663549 | 703 | |
becanromain | 4:6a3d12663549 | 704 | Page = lv_page_create(lv_scr_act(), NULL); |
becanromain | 4:6a3d12663549 | 705 | lv_obj_set_size(Page, hres, vres); |
becanromain | 4:6a3d12663549 | 706 | lv_obj_set_pos(Page, 0, 40); |
becanromain | 4:6a3d12663549 | 707 | |
becanromain | 0:cf6b1eca3e67 | 708 | |
becanromain | 0:cf6b1eca3e67 | 709 | lv_page_set_scrl_layout(Page, LV_LAYOUT_OFF); |
becanromain | 0:cf6b1eca3e67 | 710 | lv_page_set_scrl_fit2(Page, LV_FIT_FLOOD, LV_FIT_TIGHT); |
becanromain | 0:cf6b1eca3e67 | 711 | lv_coord_t max_w = lv_page_get_fit_width(Page); |
becanromain | 0:cf6b1eca3e67 | 712 | |
becanromain | 4:6a3d12663549 | 713 | // PAGE 101: Mesures |
becanromain | 4:6a3d12663549 | 714 | if (Num==101){ |
becanromain | 4:6a3d12663549 | 715 | |
becanromain | 4:6a3d12663549 | 716 | //affichage données |
becanromain | 4:6a3d12663549 | 717 | int i=0; |
becanromain | 4:6a3d12663549 | 718 | AffTensionBat = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 719 | lv_obj_set_pos(AffTensionBat, 50, i); |
becanromain | 4:6a3d12663549 | 720 | |
becanromain | 4:6a3d12663549 | 721 | AffTpsCy = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 722 | i=i+16;lv_obj_set_pos(AffTpsCy, 50, i); |
becanromain | 4:6a3d12663549 | 723 | |
becanromain | 4:6a3d12663549 | 724 | AffCptPuls = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 725 | i=i+16;lv_obj_set_pos(AffCptPuls, 50, i); |
becanromain | 4:6a3d12663549 | 726 | |
becanromain | 4:6a3d12663549 | 727 | AffVolume = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 728 | i=i+16;lv_obj_set_pos(AffVolume, 50, i); |
becanromain | 4:6a3d12663549 | 729 | |
becanromain | 4:6a3d12663549 | 730 | AffDebit = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 731 | i=i+16;lv_obj_set_pos(AffDebit, 50, i); |
becanromain | 4:6a3d12663549 | 732 | |
becanromain | 4:6a3d12663549 | 733 | Aff1TpsEntre2Puls = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 734 | i=i+16;lv_obj_set_pos(Aff1TpsEntre2Puls, 50, i); |
becanromain | 4:6a3d12663549 | 735 | |
becanromain | 4:6a3d12663549 | 736 | Aff2TpsEntre2Puls = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 737 | i=i+16;lv_obj_set_pos(Aff2TpsEntre2Puls, 50, i); |
becanromain | 4:6a3d12663549 | 738 | |
becanromain | 4:6a3d12663549 | 739 | AffTpsMinEntre2Puls = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 740 | i=i+16;lv_obj_set_pos(AffTpsMinEntre2Puls, 50, i); |
becanromain | 0:cf6b1eca3e67 | 741 | |
becanromain | 4:6a3d12663549 | 742 | AffTpsMaxEntre2Puls = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 743 | i=i+16;lv_obj_set_pos(AffTpsMaxEntre2Puls, 50, i); |
becanromain | 4:6a3d12663549 | 744 | |
becanromain | 4:6a3d12663549 | 745 | //BP RAZ |
becanromain | 4:6a3d12663549 | 746 | BPRAZ = lv_btn_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 747 | i=i+30;lv_obj_set_pos(BPRAZ, 50, i); |
becanromain | 4:6a3d12663549 | 748 | label = lv_label_create(BPRAZ, NULL); |
becanromain | 4:6a3d12663549 | 749 | lv_label_set_text(label, "RAZ"); |
becanromain | 4:6a3d12663549 | 750 | lv_obj_set_size(BPRAZ,60,40); |
becanromain | 4:6a3d12663549 | 751 | lv_obj_set_event_cb(BPRAZ, BPRAZ_ACT); |
becanromain | 4:6a3d12663549 | 752 | |
becanromain | 4:6a3d12663549 | 753 | //BP POMPE |
becanromain | 4:6a3d12663549 | 754 | BPPOMPE = lv_btn_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 755 | lv_obj_set_pos(BPPOMPE, 150, i); |
becanromain | 4:6a3d12663549 | 756 | label = lv_label_create(BPPOMPE, NULL); |
becanromain | 4:6a3d12663549 | 757 | lv_label_set_text(label, "POMPE"); |
becanromain | 4:6a3d12663549 | 758 | lv_obj_set_size(BPPOMPE,90,40); |
becanromain | 4:6a3d12663549 | 759 | lv_btn_set_toggle(BPPOMPE, true); |
becanromain | 4:6a3d12663549 | 760 | lv_obj_set_event_cb(BPPOMPE, BPPOMPE_ACT); |
becanromain | 4:6a3d12663549 | 761 | |
becanromain | 4:6a3d12663549 | 762 | // SLIDER |
becanromain | 4:6a3d12663549 | 763 | static lv_style_t style_bg,style_knob; |
becanromain | 4:6a3d12663549 | 764 | static lv_style_t style_indic_R; |
becanromain | 0:cf6b1eca3e67 | 765 | |
becanromain | 0:cf6b1eca3e67 | 766 | |
becanromain | 4:6a3d12663549 | 767 | lv_style_copy(&style_bg, &lv_style_pretty); |
becanromain | 4:6a3d12663549 | 768 | style_bg.body.main_color = LV_COLOR_BLACK; |
becanromain | 4:6a3d12663549 | 769 | style_bg.body.grad_color = LV_COLOR_BLACK; |
becanromain | 4:6a3d12663549 | 770 | style_bg.body.radius = LV_RADIUS_CIRCLE; |
becanromain | 4:6a3d12663549 | 771 | style_bg.body.border.color = LV_COLOR_SILVER; |
becanromain | 0:cf6b1eca3e67 | 772 | |
becanromain | 4:6a3d12663549 | 773 | lv_style_copy(&style_indic_R, &lv_style_pretty_color); |
becanromain | 4:6a3d12663549 | 774 | style_indic_R.body.main_color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 775 | style_indic_R.body.grad_color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 776 | style_indic_R.body.radius = LV_RADIUS_CIRCLE; |
becanromain | 4:6a3d12663549 | 777 | style_indic_R.body.shadow.width = 4; |
becanromain | 4:6a3d12663549 | 778 | style_indic_R.body.shadow.color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 779 | style_indic_R.body.padding.left = 3; |
becanromain | 4:6a3d12663549 | 780 | style_indic_R.body.padding.right = 3; |
becanromain | 4:6a3d12663549 | 781 | style_indic_R.body.padding.top = 3; |
becanromain | 4:6a3d12663549 | 782 | style_indic_R.body.padding.bottom = 3; |
becanromain | 4:6a3d12663549 | 783 | |
becanromain | 4:6a3d12663549 | 784 | lv_style_copy(&style_knob, &lv_style_pretty); |
becanromain | 4:6a3d12663549 | 785 | style_knob.body.radius = LV_RADIUS_CIRCLE; |
becanromain | 4:6a3d12663549 | 786 | style_knob.body.opa = LV_OPA_70; |
becanromain | 4:6a3d12663549 | 787 | style_knob.body.padding.top = 10 ; |
becanromain | 4:6a3d12663549 | 788 | style_knob.body.padding.bottom = 10 ; |
becanromain | 4:6a3d12663549 | 789 | |
becanromain | 4:6a3d12663549 | 790 | /*Create a slider ROUGE*/ |
becanromain | 4:6a3d12663549 | 791 | R = lv_slider_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 792 | lv_obj_set_pos(R, 10, 40); |
becanromain | 4:6a3d12663549 | 793 | lv_obj_set_width(R, 30); |
becanromain | 4:6a3d12663549 | 794 | lv_obj_set_height(R, 180); |
becanromain | 4:6a3d12663549 | 795 | lv_slider_set_range(R, 0, 10000); |
becanromain | 4:6a3d12663549 | 796 | lv_slider_set_value(R, Reglage_R, false); |
becanromain | 4:6a3d12663549 | 797 | style_indic_R.body.main_color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 798 | style_indic_R.body.grad_color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 799 | style_indic_R.body.shadow.color = LV_COLOR_RED; |
becanromain | 4:6a3d12663549 | 800 | lv_slider_set_style(R, LV_SLIDER_STYLE_BG, &style_bg); |
becanromain | 4:6a3d12663549 | 801 | lv_slider_set_style(R, LV_SLIDER_STYLE_INDIC,&style_indic_R); |
becanromain | 4:6a3d12663549 | 802 | lv_slider_set_style(R, LV_SLIDER_STYLE_KNOB, &style_knob); |
becanromain | 4:6a3d12663549 | 803 | lv_obj_set_event_cb(R, Reglage_R_RGB); |
becanromain | 4:6a3d12663549 | 804 | Val_R = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 805 | lv_obj_align(Val_R, R, LV_ALIGN_OUT_TOP_MID, 0, -5); |
becanromain | 4:6a3d12663549 | 806 | sprintf(text, " %d ", lv_slider_get_value(R)); |
becanromain | 4:6a3d12663549 | 807 | lv_label_set_text(Val_R, text); |
becanromain | 4:6a3d12663549 | 808 | } |
becanromain | 4:6a3d12663549 | 809 | |
becanromain | 4:6a3d12663549 | 810 | //PAGE 301 SELECTION LANGUE |
becanromain | 4:6a3d12663549 | 811 | if (Num==301){ |
becanromain | 4:6a3d12663549 | 812 | //TITRE |
becanromain | 4:6a3d12663549 | 813 | label = lv_label_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 814 | lv_label_set_text(label, _("SELECTION LANGUE")); |
becanromain | 4:6a3d12663549 | 815 | lv_obj_align(label, Page, LV_ALIGN_IN_TOP_MID, 0, 5); |
becanromain | 4:6a3d12663549 | 816 | |
becanromain | 4:6a3d12663549 | 817 | //BP SELECTION LANGUE: FRANCAIS |
becanromain | 4:6a3d12663549 | 818 | lv_obj_t * LANGUE_FR = lv_btn_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 819 | lv_obj_align(LANGUE_FR, Page, LV_ALIGN_IN_TOP_MID, -80, 50); |
becanromain | 4:6a3d12663549 | 820 | label = lv_label_create(LANGUE_FR, NULL); |
becanromain | 4:6a3d12663549 | 821 | lv_label_set_text(label, _("Francais")); |
becanromain | 4:6a3d12663549 | 822 | lv_obj_set_size(LANGUE_FR,100,40); |
becanromain | 4:6a3d12663549 | 823 | lv_obj_set_event_cb(LANGUE_FR, LANGUE_FR_ACT); |
becanromain | 4:6a3d12663549 | 824 | |
becanromain | 4:6a3d12663549 | 825 | //BP SELECTION LANGUE: ANGLAIS |
becanromain | 4:6a3d12663549 | 826 | lv_obj_t * LANGUE_EN = lv_btn_create(Page, NULL); |
becanromain | 4:6a3d12663549 | 827 | lv_obj_align(LANGUE_EN, Page, LV_ALIGN_IN_TOP_MID, 80, 50); |
becanromain | 4:6a3d12663549 | 828 | label = lv_label_create(LANGUE_EN, NULL); |
becanromain | 4:6a3d12663549 | 829 | lv_label_set_text(label, _("English")); |
becanromain | 4:6a3d12663549 | 830 | lv_obj_set_size(LANGUE_EN,100,40); |
becanromain | 4:6a3d12663549 | 831 | lv_obj_set_event_cb(LANGUE_EN, LANGUE_EN_ACT); |
becanromain | 4:6a3d12663549 | 832 | } |
becanromain | 4:6a3d12663549 | 833 | |
becanromain | 0:cf6b1eca3e67 | 834 | |
becanromain | 0:cf6b1eca3e67 | 835 | } |
becanromain | 0:cf6b1eca3e67 | 836 | |
becanromain | 0:cf6b1eca3e67 | 837 | |
becanromain | 0:cf6b1eca3e67 | 838 | |
becanromain | 0:cf6b1eca3e67 | 839 | |
becanromain | 0:cf6b1eca3e67 | 840 | //******************** |
becanromain | 0:cf6b1eca3e67 | 841 | // POPUP CONNEXION MDP |
becanromain | 0:cf6b1eca3e67 | 842 | //******************** |
becanromain | 0:cf6b1eca3e67 | 843 | static void AFFPopupMDP(){ |
becanromain | 0:cf6b1eca3e67 | 844 | //FOND GRISE |
becanromain | 0:cf6b1eca3e67 | 845 | static lv_style_t modal_style; |
becanromain | 0:cf6b1eca3e67 | 846 | lv_style_copy(&modal_style, &lv_style_plain_color); |
becanromain | 0:cf6b1eca3e67 | 847 | modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; |
becanromain | 0:cf6b1eca3e67 | 848 | modal_style.body.opa = LV_OPA_50; |
becanromain | 0:cf6b1eca3e67 | 849 | FondGris = lv_obj_create(lv_scr_act(), NULL); |
becanromain | 0:cf6b1eca3e67 | 850 | lv_obj_set_style(FondGris, &modal_style); |
becanromain | 0:cf6b1eca3e67 | 851 | lv_obj_set_pos(FondGris, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 852 | lv_obj_set_size(FondGris, LV_HOR_RES, LV_VER_RES); |
becanromain | 0:cf6b1eca3e67 | 853 | lv_obj_set_opa_scale_enable(FondGris, true); |
becanromain | 0:cf6b1eca3e67 | 854 | |
becanromain | 0:cf6b1eca3e67 | 855 | // CREATION POPUP CONNEXION MDP |
becanromain | 0:cf6b1eca3e67 | 856 | PopupMDP = lv_obj_create(FondGris, NULL); |
becanromain | 0:cf6b1eca3e67 | 857 | lv_obj_set_size(PopupMDP,400,260); |
becanromain | 0:cf6b1eca3e67 | 858 | lv_obj_align(PopupMDP, FondGris, LV_ALIGN_CENTER, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 859 | lv_obj_set_opa_scale_enable(PopupMDP, true); |
becanromain | 0:cf6b1eca3e67 | 860 | lv_obj_set_opa_scale(PopupMDP, 240); |
becanromain | 0:cf6b1eca3e67 | 861 | |
becanromain | 0:cf6b1eca3e67 | 862 | //TITRE |
becanromain | 0:cf6b1eca3e67 | 863 | label = lv_label_create(PopupMDP, NULL); |
becanromain | 4:6a3d12663549 | 864 | lv_label_set_text(label, _("IDENTIFICATION")); |
becanromain | 0:cf6b1eca3e67 | 865 | lv_obj_align(label, PopupMDP, LV_ALIGN_IN_TOP_MID, 0, 3); |
becanromain | 0:cf6b1eca3e67 | 866 | lv_obj_set_opa_scale_enable(label, true); |
becanromain | 0:cf6b1eca3e67 | 867 | lv_obj_set_opa_scale(label, LV_OPA_COVER); |
becanromain | 0:cf6b1eca3e67 | 868 | |
becanromain | 0:cf6b1eca3e67 | 869 | //CREATION LISTE UTILISATEUR POUR AFFICHAGE |
becanromain | 4:6a3d12663549 | 870 | //G/ABOR: Mabye you have a better solution than: |
kisvegabor | 1:404ee28a0b60 | 871 | //ROMAIN: There is no much better way, but I have a few comments |
becanromain | 0:cf6b1eca3e67 | 872 | int i; |
becanromain | 0:cf6b1eca3e67 | 873 | int j; |
becanromain | 0:cf6b1eca3e67 | 874 | int k=0; |
becanromain | 0:cf6b1eca3e67 | 875 | char p[2200]; |
kisvegabor | 1:404ee28a0b60 | 876 | |
kisvegabor | 1:404ee28a0b60 | 877 | //ROMAIN: |
kisvegabor | 1:404ee28a0b60 | 878 | // - p[i]=='\0'; it should be p[i]='\0'; isn't it? |
kisvegabor | 1:404ee28a0b60 | 879 | // - If so why not start from i = 0 to initalize? |
kisvegabor | 1:404ee28a0b60 | 880 | // - memset(p, '\0', sizeof(p)) can be a clearer option to initialize |
kisvegabor | 1:404ee28a0b60 | 881 | for (i = 1; i < 2200; i++) { p[i]=='\0';} |
kisvegabor | 1:404ee28a0b60 | 882 | |
kisvegabor | 1:404ee28a0b60 | 883 | for (i = 1; i < 100; i++) { //ROMAIN: Why start from 1? |
becanromain | 0:cf6b1eca3e67 | 884 | string s=User[i].Nom; |
becanromain | 0:cf6b1eca3e67 | 885 | if (s.length()>0){ |
kisvegabor | 1:404ee28a0b60 | 886 | //ROMAIN: I suggest using memcpy instead |
kisvegabor | 1:404ee28a0b60 | 887 | // memcpy(&p[k], s, s.length()) |
kisvegabor | 1:404ee28a0b60 | 888 | // k += s.length(); |
kisvegabor | 1:404ee28a0b60 | 889 | // p[k] = '\n'; |
kisvegabor | 1:404ee28a0b60 | 890 | // k++; |
becanromain | 0:cf6b1eca3e67 | 891 | for (j = 0; j < s.length(); j++) { |
becanromain | 0:cf6b1eca3e67 | 892 | p[k] = s[j]; |
becanromain | 0:cf6b1eca3e67 | 893 | k++; |
becanromain | 0:cf6b1eca3e67 | 894 | } |
becanromain | 0:cf6b1eca3e67 | 895 | p[k]='\n'; |
becanromain | 0:cf6b1eca3e67 | 896 | k++; |
becanromain | 0:cf6b1eca3e67 | 897 | } |
becanromain | 0:cf6b1eca3e67 | 898 | } |
kisvegabor | 1:404ee28a0b60 | 899 | //ROMAIN: |
kisvegabor | 1:404ee28a0b60 | 900 | // - you alraedy incremented k, so it should p[k] = '\0', shouldn't it? |
kisvegabor | 1:404ee28a0b60 | 901 | // - and you initialized p to '\0' so it's not required |
becanromain | 0:cf6b1eca3e67 | 902 | p[k+1]='\0'; |
becanromain | 0:cf6b1eca3e67 | 903 | char * ListeUser= p ; |
becanromain | 0:cf6b1eca3e67 | 904 | |
becanromain | 0:cf6b1eca3e67 | 905 | //SELECTEUR UTILISATEUR |
becanromain | 0:cf6b1eca3e67 | 906 | SelectID = lv_roller_create(PopupMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 907 | lv_roller_set_options(SelectID,ListeUser,LV_ROLLER_MODE_NORMAL); |
becanromain | 0:cf6b1eca3e67 | 908 | lv_roller_set_visible_row_count(SelectID, 9); |
becanromain | 0:cf6b1eca3e67 | 909 | lv_roller_set_fix_width(SelectID, 170); |
becanromain | 0:cf6b1eca3e67 | 910 | lv_obj_align(SelectID, PopupMDP, LV_ALIGN_IN_TOP_LEFT, 10, 20); |
becanromain | 0:cf6b1eca3e67 | 911 | |
becanromain | 0:cf6b1eca3e67 | 912 | //CHAMPS MOT DE PASSE |
becanromain | 0:cf6b1eca3e67 | 913 | MDP = lv_ta_create(PopupMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 914 | lv_ta_set_text(MDP, ""); |
becanromain | 0:cf6b1eca3e67 | 915 | lv_ta_set_pwd_mode(MDP, true); |
becanromain | 0:cf6b1eca3e67 | 916 | lv_ta_set_one_line(MDP, true); |
becanromain | 0:cf6b1eca3e67 | 917 | lv_obj_set_width(MDP, 170); |
becanromain | 0:cf6b1eca3e67 | 918 | lv_obj_align(MDP, PopupMDP, LV_ALIGN_IN_TOP_RIGHT, -10, 20); |
becanromain | 0:cf6b1eca3e67 | 919 | lv_obj_set_opa_scale_enable(MDP, true); |
becanromain | 0:cf6b1eca3e67 | 920 | lv_obj_set_opa_scale(MDP, LV_OPA_COVER); |
becanromain | 0:cf6b1eca3e67 | 921 | lv_ta_set_max_length(MDP, 4); |
becanromain | 0:cf6b1eca3e67 | 922 | |
becanromain | 0:cf6b1eca3e67 | 923 | // PAVE NUMERIQUE SAISIE MOT DE PASSE |
becanromain | 0:cf6b1eca3e67 | 924 | static lv_style_t rel_style, pr_style; //STYLE CLAVIER |
becanromain | 0:cf6b1eca3e67 | 925 | lv_style_copy(&rel_style, &lv_style_btn_rel); |
becanromain | 0:cf6b1eca3e67 | 926 | rel_style.body.radius = 0; |
becanromain | 0:cf6b1eca3e67 | 927 | rel_style.body.border.width = 1; |
becanromain | 0:cf6b1eca3e67 | 928 | lv_style_copy(&pr_style, &lv_style_btn_pr); |
becanromain | 0:cf6b1eca3e67 | 929 | pr_style.body.radius = 0; |
becanromain | 0:cf6b1eca3e67 | 930 | pr_style.body.border.width = 1; |
becanromain | 0:cf6b1eca3e67 | 931 | |
becanromain | 0:cf6b1eca3e67 | 932 | lv_obj_t * PaveNumerique = lv_kb_create(PopupMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 933 | lv_obj_set_size(PaveNumerique,170,170); |
becanromain | 0:cf6b1eca3e67 | 934 | lv_btnm_set_map(PaveNumerique, PAVE_NUMERIQUE_MAP); |
becanromain | 0:cf6b1eca3e67 | 935 | lv_btnm_set_btn_width(PaveNumerique, 10, 2); |
becanromain | 0:cf6b1eca3e67 | 936 | lv_obj_align(PaveNumerique, PopupMDP, LV_ALIGN_IN_TOP_RIGHT, -10, 50); |
becanromain | 0:cf6b1eca3e67 | 937 | lv_obj_set_opa_scale_enable(PaveNumerique, true); |
becanromain | 0:cf6b1eca3e67 | 938 | lv_obj_set_opa_scale(PaveNumerique, LV_OPA_COVER); |
becanromain | 0:cf6b1eca3e67 | 939 | lv_kb_set_cursor_manage(PaveNumerique, true); |
becanromain | 0:cf6b1eca3e67 | 940 | lv_kb_set_style(PaveNumerique, LV_KB_STYLE_BG, &lv_style_transp_tight); |
becanromain | 0:cf6b1eca3e67 | 941 | lv_kb_set_style(PaveNumerique, LV_KB_STYLE_BTN_REL, &rel_style); |
becanromain | 0:cf6b1eca3e67 | 942 | lv_kb_set_style(PaveNumerique, LV_KB_STYLE_BTN_PR, &pr_style); |
becanromain | 0:cf6b1eca3e67 | 943 | lv_kb_set_ta(PaveNumerique, MDP); //ASSOCIATION CLAVIER ET CHAMPS MDP |
becanromain | 0:cf6b1eca3e67 | 944 | |
becanromain | 0:cf6b1eca3e67 | 945 | // STYLE DES BOUTONS |
becanromain | 0:cf6b1eca3e67 | 946 | lv_style_copy(&Style_BP, &lv_style_btn_rel); |
becanromain | 0:cf6b1eca3e67 | 947 | Style_BP.text.font = &lv_font_roboto_12; |
becanromain | 0:cf6b1eca3e67 | 948 | Style_BP.body.main_color = LV_COLOR_MAKE(R3, G3, B3); |
becanromain | 0:cf6b1eca3e67 | 949 | |
becanromain | 0:cf6b1eca3e67 | 950 | //BP VALIDER |
becanromain | 0:cf6b1eca3e67 | 951 | lv_obj_t * BpValidMDP=lv_btn_create(PopupMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 952 | lv_btn_set_style(BpValidMDP, LV_BTN_STYLE_REL,&Style_BP); |
becanromain | 0:cf6b1eca3e67 | 953 | lv_obj_set_size(BpValidMDP,100,30); |
becanromain | 0:cf6b1eca3e67 | 954 | lv_obj_align(BpValidMDP, PopupMDP, LV_ALIGN_IN_BOTTOM_MID, -60, -5); |
becanromain | 0:cf6b1eca3e67 | 955 | label = lv_label_create(BpValidMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 956 | lv_label_set_text(label, "Valider"); |
becanromain | 0:cf6b1eca3e67 | 957 | lv_obj_set_drag_parent(BpValidMDP, true); |
becanromain | 0:cf6b1eca3e67 | 958 | lv_obj_set_event_cb(BpValidMDP, BpValidMDP_ACT); |
becanromain | 0:cf6b1eca3e67 | 959 | lv_obj_set_opa_scale_enable(BpValidMDP, true); |
becanromain | 0:cf6b1eca3e67 | 960 | lv_obj_set_opa_scale(BpValidMDP, LV_OPA_COVER); |
becanromain | 0:cf6b1eca3e67 | 961 | |
becanromain | 0:cf6b1eca3e67 | 962 | //BP ANNULER |
becanromain | 0:cf6b1eca3e67 | 963 | lv_obj_t * BpAnnulMDP=lv_btn_create(PopupMDP, NULL); |
becanromain | 0:cf6b1eca3e67 | 964 | lv_btn_set_style(BpAnnulMDP, LV_BTN_STYLE_REL,&Style_BP); |
becanromain | 0:cf6b1eca3e67 | 965 | lv_obj_set_size(BpAnnulMDP,100,30); |
becanromain | 0:cf6b1eca3e67 | 966 | lv_obj_align(BpAnnulMDP, PopupMDP, LV_ALIGN_IN_BOTTOM_MID, 60, -5); |
becanromain | 0:cf6b1eca3e67 | 967 | label = lv_label_create(BpAnnulMDP, NULL); |
becanromain | 4:6a3d12663549 | 968 | lv_label_set_text(label, _("Annuler")); |
becanromain | 0:cf6b1eca3e67 | 969 | |
becanromain | 0:cf6b1eca3e67 | 970 | lv_obj_set_drag_parent(BpAnnulMDP, true); |
becanromain | 0:cf6b1eca3e67 | 971 | lv_obj_set_event_cb(BpAnnulMDP, BpAnnulMDP_ACT); |
becanromain | 0:cf6b1eca3e67 | 972 | lv_obj_set_opa_scale_enable(BpAnnulMDP, true); |
becanromain | 0:cf6b1eca3e67 | 973 | lv_obj_set_opa_scale(BpAnnulMDP, LV_OPA_COVER); |
becanromain | 0:cf6b1eca3e67 | 974 | |
becanromain | 0:cf6b1eca3e67 | 975 | } |
becanromain | 0:cf6b1eca3e67 | 976 | |
becanromain | 0:cf6b1eca3e67 | 977 | static void BpValidMDP_ACT(lv_obj_t * obj, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 978 | { |
becanromain | 0:cf6b1eca3e67 | 979 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 980 | //RECUPERATION DU NOM DE L'UTILISATEUR SELECTIONNE |
becanromain | 0:cf6b1eca3e67 | 981 | char NomSelect[20]; |
becanromain | 0:cf6b1eca3e67 | 982 | lv_roller_get_selected_str(SelectID, NomSelect, sizeof(NomSelect)); |
becanromain | 0:cf6b1eca3e67 | 983 | |
becanromain | 0:cf6b1eca3e67 | 984 | //RECUPERATION MOT DE PASSE SAISIE |
becanromain | 0:cf6b1eca3e67 | 985 | string MdpSaisie; |
becanromain | 0:cf6b1eca3e67 | 986 | MdpSaisie = lv_ta_get_text(MDP); |
becanromain | 0:cf6b1eca3e67 | 987 | |
becanromain | 0:cf6b1eca3e67 | 988 | //FOND GRISE |
becanromain | 0:cf6b1eca3e67 | 989 | static lv_style_t modal_style; |
becanromain | 0:cf6b1eca3e67 | 990 | lv_style_copy(&modal_style, &lv_style_plain_color); |
becanromain | 0:cf6b1eca3e67 | 991 | modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; |
becanromain | 0:cf6b1eca3e67 | 992 | modal_style.body.opa = LV_OPA_50; |
becanromain | 0:cf6b1eca3e67 | 993 | FondGris2 = lv_obj_create(lv_scr_act(), NULL); |
becanromain | 0:cf6b1eca3e67 | 994 | lv_obj_set_style(FondGris2, &modal_style); |
becanromain | 0:cf6b1eca3e67 | 995 | lv_obj_set_pos(FondGris2, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 996 | lv_obj_set_size(FondGris2, LV_HOR_RES, LV_VER_RES); |
becanromain | 0:cf6b1eca3e67 | 997 | lv_obj_set_opa_scale_enable(FondGris2, true); |
becanromain | 0:cf6b1eca3e67 | 998 | //COMPARAISON AVEC LISTE |
becanromain | 0:cf6b1eca3e67 | 999 | static const char * btns2[] = {"Ok", ""}; |
becanromain | 0:cf6b1eca3e67 | 1000 | for (int i = 1; i < 100; i++) { |
becanromain | 0:cf6b1eca3e67 | 1001 | if (User[i].Nom==NomSelect) |
becanromain | 0:cf6b1eca3e67 | 1002 | if (User[i].MDP==MdpSaisie){ |
becanromain | 0:cf6b1eca3e67 | 1003 | mbox=lv_mbox_create(FondGris2, NULL); |
becanromain | 0:cf6b1eca3e67 | 1004 | lv_mbox_add_btns(mbox, btns2); |
becanromain | 0:cf6b1eca3e67 | 1005 | if (User[i].Niveau==1){sprintf(text2, "qu'operateur" );} |
becanromain | 0:cf6b1eca3e67 | 1006 | if (User[i].Niveau==2){sprintf(text2, "que superviseur");} |
becanromain | 0:cf6b1eca3e67 | 1007 | if (User[i].Niveau==3){sprintf(text2, "que constructeur");} |
becanromain | 0:cf6b1eca3e67 | 1008 | 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 | 1009 | lv_mbox_set_text(mbox, text); |
becanromain | 0:cf6b1eca3e67 | 1010 | lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 1011 | lv_obj_set_event_cb(mbox, mboxMdp_ACT); |
becanromain | 0:cf6b1eca3e67 | 1012 | TpsMdpEnCours=User[i].Tps*60; |
becanromain | 0:cf6b1eca3e67 | 1013 | UserEC=User[i]; |
becanromain | 0:cf6b1eca3e67 | 1014 | //RECLASSEMENT DU TABLEAU DES UTILISATEURS POUR AVOIR LE DERNIER CONNECTé EN PREMIER |
becanromain | 0:cf6b1eca3e67 | 1015 | User[0]=User[i]; |
becanromain | 0:cf6b1eca3e67 | 1016 | for (int j = i; j >0; j--) { //DECALAGE TABLEAU |
becanromain | 0:cf6b1eca3e67 | 1017 | User[j]=User[j-1]; |
becanromain | 0:cf6b1eca3e67 | 1018 | } |
becanromain | 0:cf6b1eca3e67 | 1019 | return; |
becanromain | 0:cf6b1eca3e67 | 1020 | } |
becanromain | 0:cf6b1eca3e67 | 1021 | } |
becanromain | 0:cf6b1eca3e67 | 1022 | mbox=lv_mbox_create(FondGris2, NULL); |
becanromain | 0:cf6b1eca3e67 | 1023 | lv_mbox_add_btns(mbox, btns2); |
becanromain | 0:cf6b1eca3e67 | 1024 | lv_mbox_set_text(mbox, "MOT DE PASSE ERRONE"); |
becanromain | 0:cf6b1eca3e67 | 1025 | lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); |
becanromain | 0:cf6b1eca3e67 | 1026 | lv_obj_set_event_cb(mbox, mboxMdp_ACT2); |
becanromain | 0:cf6b1eca3e67 | 1027 | } |
becanromain | 0:cf6b1eca3e67 | 1028 | } |
becanromain | 0:cf6b1eca3e67 | 1029 | static void BpAnnulMDP_ACT(lv_obj_t * obj, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1030 | { |
becanromain | 0:cf6b1eca3e67 | 1031 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1032 | // lv_obj_del_async(PopupMDP); |
becanromain | 0:cf6b1eca3e67 | 1033 | lv_obj_del_async(FondGris); |
becanromain | 0:cf6b1eca3e67 | 1034 | } |
becanromain | 0:cf6b1eca3e67 | 1035 | } |
becanromain | 0:cf6b1eca3e67 | 1036 | |
becanromain | 0:cf6b1eca3e67 | 1037 | static void mboxMdp_ACT(lv_obj_t * obj, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1038 | { |
becanromain | 0:cf6b1eca3e67 | 1039 | lv_obj_del_async(FondGris); |
becanromain | 0:cf6b1eca3e67 | 1040 | lv_obj_del_async(FondGris2); |
becanromain | 0:cf6b1eca3e67 | 1041 | |
becanromain | 0:cf6b1eca3e67 | 1042 | |
becanromain | 0:cf6b1eca3e67 | 1043 | } |
becanromain | 0:cf6b1eca3e67 | 1044 | static void mboxMdp_ACT2(lv_obj_t * obj, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1045 | { |
becanromain | 0:cf6b1eca3e67 | 1046 | lv_obj_del_async(FondGris2); |
becanromain | 0:cf6b1eca3e67 | 1047 | lv_ta_set_text(MDP, ""); |
becanromain | 0:cf6b1eca3e67 | 1048 | } |
becanromain | 0:cf6b1eca3e67 | 1049 | |
becanromain | 0:cf6b1eca3e67 | 1050 | |
becanromain | 0:cf6b1eca3e67 | 1051 | //************************** |
becanromain | 0:cf6b1eca3e67 | 1052 | // ACTION BOUTONS MENUS |
becanromain | 0:cf6b1eca3e67 | 1053 | //************************** |
becanromain | 0:cf6b1eca3e67 | 1054 | |
becanromain | 0:cf6b1eca3e67 | 1055 | static void Reglage_R_RGB(lv_obj_t * obj, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1056 | { |
becanromain | 0:cf6b1eca3e67 | 1057 | if(event == LV_EVENT_PRESSING) { |
becanromain | 0:cf6b1eca3e67 | 1058 | Reglage_R= lv_slider_get_value(obj); |
becanromain | 0:cf6b1eca3e67 | 1059 | sprintf(text, " %d ",Reglage_R ); |
becanromain | 0:cf6b1eca3e67 | 1060 | lv_label_set_text(Val_R, text); |
becanromain | 0:cf6b1eca3e67 | 1061 | } |
becanromain | 0:cf6b1eca3e67 | 1062 | } |
becanromain | 0:cf6b1eca3e67 | 1063 | |
becanromain | 0:cf6b1eca3e67 | 1064 | static void BPRAZ_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1065 | { |
becanromain | 0:cf6b1eca3e67 | 1066 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1067 | TpsMinEntre2Puls=999999; |
becanromain | 0:cf6b1eca3e67 | 1068 | TpsMaxEntre2Puls=0; |
becanromain | 0:cf6b1eca3e67 | 1069 | CptPuls=0; |
becanromain | 0:cf6b1eca3e67 | 1070 | Volume=0; |
becanromain | 0:cf6b1eca3e67 | 1071 | for (NumDent=20;NumDent>0;NumDent--){ |
becanromain | 0:cf6b1eca3e67 | 1072 | TpsEntre2Puls[NumDent]=0; |
becanromain | 0:cf6b1eca3e67 | 1073 | MemTpsPuls=0; |
becanromain | 0:cf6b1eca3e67 | 1074 | MemTps16Puls=0; |
becanromain | 0:cf6b1eca3e67 | 1075 | } |
becanromain | 0:cf6b1eca3e67 | 1076 | } |
becanromain | 0:cf6b1eca3e67 | 1077 | } |
becanromain | 4:6a3d12663549 | 1078 | static void BPPOMPE_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 4:6a3d12663549 | 1079 | { |
becanromain | 4:6a3d12663549 | 1080 | if(event == LV_EVENT_CLICKED) { |
becanromain | 4:6a3d12663549 | 1081 | DO_POMPE=!DO_POMPE; |
becanromain | 4:6a3d12663549 | 1082 | } |
becanromain | 4:6a3d12663549 | 1083 | } |
becanromain | 4:6a3d12663549 | 1084 | static void LANGUE_FR_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 4:6a3d12663549 | 1085 | { |
becanromain | 4:6a3d12663549 | 1086 | if(event == LV_EVENT_CLICKED) { |
becanromain | 4:6a3d12663549 | 1087 | lv_i18n_set_locale("fr"); |
becanromain | 4:6a3d12663549 | 1088 | AFFBandeauHaut(0); |
becanromain | 4:6a3d12663549 | 1089 | AFFPage(PageAff); |
becanromain | 4:6a3d12663549 | 1090 | } |
becanromain | 4:6a3d12663549 | 1091 | } |
becanromain | 4:6a3d12663549 | 1092 | static void LANGUE_EN_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 4:6a3d12663549 | 1093 | { |
becanromain | 4:6a3d12663549 | 1094 | if(event == LV_EVENT_CLICKED) { |
becanromain | 4:6a3d12663549 | 1095 | lv_i18n_set_locale("en-GB"); |
becanromain | 4:6a3d12663549 | 1096 | AFFBandeauHaut(0); |
becanromain | 4:6a3d12663549 | 1097 | AFFPage(PageAff); |
becanromain | 4:6a3d12663549 | 1098 | } |
becanromain | 4:6a3d12663549 | 1099 | } |
becanromain | 0:cf6b1eca3e67 | 1100 | static void M100_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1101 | { |
becanromain | 0:cf6b1eca3e67 | 1102 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1103 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1104 | PosX_MenuCible = -lv_obj_get_x(M100); |
becanromain | 0:cf6b1eca3e67 | 1105 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1106 | NumSousMenu=100; |
becanromain | 0:cf6b1eca3e67 | 1107 | } |
becanromain | 0:cf6b1eca3e67 | 1108 | } |
becanromain | 0:cf6b1eca3e67 | 1109 | static void M200_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1110 | { |
becanromain | 0:cf6b1eca3e67 | 1111 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1112 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1113 | PosX_MenuCible = -lv_obj_get_x(M200); |
becanromain | 0:cf6b1eca3e67 | 1114 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1115 | NumSousMenu=200; |
becanromain | 0:cf6b1eca3e67 | 1116 | } |
becanromain | 0:cf6b1eca3e67 | 1117 | } |
becanromain | 0:cf6b1eca3e67 | 1118 | static void M300_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1119 | { |
becanromain | 0:cf6b1eca3e67 | 1120 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1121 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1122 | PosX_MenuCible = -lv_obj_get_x(M300); |
becanromain | 0:cf6b1eca3e67 | 1123 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1124 | NumSousMenu=300; |
becanromain | 0:cf6b1eca3e67 | 1125 | } |
becanromain | 0:cf6b1eca3e67 | 1126 | } |
becanromain | 0:cf6b1eca3e67 | 1127 | static void M400_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1128 | { |
becanromain | 0:cf6b1eca3e67 | 1129 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1130 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1131 | PosX_MenuCible = -lv_obj_get_x(M400); |
becanromain | 0:cf6b1eca3e67 | 1132 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1133 | NumSousMenu=400; |
becanromain | 0:cf6b1eca3e67 | 1134 | } |
becanromain | 0:cf6b1eca3e67 | 1135 | } |
becanromain | 0:cf6b1eca3e67 | 1136 | static void M500_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1137 | { |
becanromain | 0:cf6b1eca3e67 | 1138 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1139 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1140 | PosX_MenuCible = -lv_obj_get_x(M500); |
becanromain | 0:cf6b1eca3e67 | 1141 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1142 | NumSousMenu=500; |
becanromain | 0:cf6b1eca3e67 | 1143 | } |
becanromain | 0:cf6b1eca3e67 | 1144 | } |
becanromain | 0:cf6b1eca3e67 | 1145 | static void M600_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1146 | { |
becanromain | 0:cf6b1eca3e67 | 1147 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1148 | PosX_MenuDepart = lv_obj_get_x(BandeauHaut); |
becanromain | 0:cf6b1eca3e67 | 1149 | PosX_MenuCible = -lv_obj_get_x(M600); |
becanromain | 0:cf6b1eca3e67 | 1150 | DdeAlignMenu=1; |
becanromain | 0:cf6b1eca3e67 | 1151 | NumSousMenu=600; |
becanromain | 0:cf6b1eca3e67 | 1152 | } |
becanromain | 0:cf6b1eca3e67 | 1153 | } |
becanromain | 0:cf6b1eca3e67 | 1154 | //************************** |
becanromain | 0:cf6b1eca3e67 | 1155 | // ACTION BOUTONS SOUS MENUS |
becanromain | 0:cf6b1eca3e67 | 1156 | //************************** |
becanromain | 0:cf6b1eca3e67 | 1157 | static void SM101_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1158 | { |
becanromain | 0:cf6b1eca3e67 | 1159 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1160 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1161 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1162 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1163 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1164 | } |
becanromain | 0:cf6b1eca3e67 | 1165 | else{ |
becanromain | 0:cf6b1eca3e67 | 1166 | TpsAvFermSousMenu=0; |
becanromain | 4:6a3d12663549 | 1167 | AFFPage(101); |
becanromain | 0:cf6b1eca3e67 | 1168 | } |
becanromain | 0:cf6b1eca3e67 | 1169 | } |
becanromain | 0:cf6b1eca3e67 | 1170 | } |
becanromain | 0:cf6b1eca3e67 | 1171 | |
becanromain | 0:cf6b1eca3e67 | 1172 | static void SM102_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1173 | { |
becanromain | 0:cf6b1eca3e67 | 1174 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1175 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1176 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1177 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1178 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1179 | } |
becanromain | 0:cf6b1eca3e67 | 1180 | else{ |
becanromain | 0:cf6b1eca3e67 | 1181 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1182 | } |
becanromain | 0:cf6b1eca3e67 | 1183 | } |
becanromain | 0:cf6b1eca3e67 | 1184 | } |
becanromain | 0:cf6b1eca3e67 | 1185 | static void SM103_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1186 | { |
becanromain | 0:cf6b1eca3e67 | 1187 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1188 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1189 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1190 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1191 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1192 | } |
becanromain | 0:cf6b1eca3e67 | 1193 | else{ |
becanromain | 0:cf6b1eca3e67 | 1194 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1195 | } |
becanromain | 0:cf6b1eca3e67 | 1196 | } |
becanromain | 0:cf6b1eca3e67 | 1197 | } |
becanromain | 0:cf6b1eca3e67 | 1198 | static void SM104_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1199 | { |
becanromain | 0:cf6b1eca3e67 | 1200 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1201 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1202 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1203 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1204 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1205 | } |
becanromain | 0:cf6b1eca3e67 | 1206 | else{ |
becanromain | 0:cf6b1eca3e67 | 1207 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1208 | } |
becanromain | 0:cf6b1eca3e67 | 1209 | } |
becanromain | 0:cf6b1eca3e67 | 1210 | } |
becanromain | 0:cf6b1eca3e67 | 1211 | static void SM105_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1212 | { |
becanromain | 0:cf6b1eca3e67 | 1213 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1214 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1215 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1216 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1217 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1218 | } |
becanromain | 0:cf6b1eca3e67 | 1219 | else{ |
becanromain | 0:cf6b1eca3e67 | 1220 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1221 | } |
becanromain | 0:cf6b1eca3e67 | 1222 | } |
becanromain | 0:cf6b1eca3e67 | 1223 | } |
becanromain | 0:cf6b1eca3e67 | 1224 | |
becanromain | 0:cf6b1eca3e67 | 1225 | static void SM201_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1226 | { |
becanromain | 0:cf6b1eca3e67 | 1227 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1228 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1229 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1230 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1231 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1232 | } |
becanromain | 0:cf6b1eca3e67 | 1233 | else{ |
becanromain | 0:cf6b1eca3e67 | 1234 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1235 | } |
becanromain | 0:cf6b1eca3e67 | 1236 | } |
becanromain | 0:cf6b1eca3e67 | 1237 | } |
becanromain | 0:cf6b1eca3e67 | 1238 | static void SM202_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1239 | { |
becanromain | 0:cf6b1eca3e67 | 1240 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1241 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1242 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1243 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1244 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1245 | } |
becanromain | 0:cf6b1eca3e67 | 1246 | else{ |
becanromain | 0:cf6b1eca3e67 | 1247 | TpsAvFermSousMenu=0; |
becanromain | 0:cf6b1eca3e67 | 1248 | } |
becanromain | 0:cf6b1eca3e67 | 1249 | } |
becanromain | 0:cf6b1eca3e67 | 1250 | } |
becanromain | 4:6a3d12663549 | 1251 | |
becanromain | 4:6a3d12663549 | 1252 | |
becanromain | 4:6a3d12663549 | 1253 | static void SM301_ACT(lv_obj_t * btn, lv_event_t event) |
becanromain | 0:cf6b1eca3e67 | 1254 | { |
becanromain | 0:cf6b1eca3e67 | 1255 | if(event == LV_EVENT_CLICKED) { |
becanromain | 0:cf6b1eca3e67 | 1256 | //VERIFICATION AUTORISATION ACCES |
becanromain | 0:cf6b1eca3e67 | 1257 | uint8_t EtatBp = lv_btn_get_state(btn); |
becanromain | 0:cf6b1eca3e67 | 1258 | if (EtatBp==LV_BTN_STATE_INA){ |
becanromain | 0:cf6b1eca3e67 | 1259 | AFFPopupMDP(); |
becanromain | 0:cf6b1eca3e67 | 1260 | } |
becanromain | 0:cf6b1eca3e67 | 1261 | else{ |
becanromain | 4:6a3d12663549 | 1262 | TpsAvFermSousMenu=0; |
becanromain | 4:6a3d12663549 | 1263 | AFFPage(301); |
becanromain | 0:cf6b1eca3e67 | 1264 | } |
becanromain | 0:cf6b1eca3e67 | 1265 | } |
becanromain | 0:cf6b1eca3e67 | 1266 | } |
becanromain | 0:cf6b1eca3e67 | 1267 | |
becanromain | 0:cf6b1eca3e67 | 1268 | |
becanromain | 0:cf6b1eca3e67 | 1269 | //******************** |
becanromain | 0:cf6b1eca3e67 | 1270 | // FONCTIONS GENERALES |
becanromain | 0:cf6b1eca3e67 | 1271 | //******************** |
becanromain | 0:cf6b1eca3e67 | 1272 | void lv_ticker_func() |
becanromain | 0:cf6b1eca3e67 | 1273 | { |
becanromain | 0:cf6b1eca3e67 | 1274 | 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 | 1275 | } |
becanromain | 0:cf6b1eca3e67 | 1276 | |
becanromain | 0:cf6b1eca3e67 | 1277 | //FONCTION D'AFFICHAGE |
becanromain | 0:cf6b1eca3e67 | 1278 | void my_disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) |
becanromain | 0:cf6b1eca3e67 | 1279 | { |
becanromain | 0:cf6b1eca3e67 | 1280 | //The most simple case (but also the slowest) to put all pixels to the screen one-by-one |
becanromain | 0:cf6b1eca3e67 | 1281 | uint16_t x, y; |
becanromain | 0:cf6b1eca3e67 | 1282 | for(y = area->y1; y <= area->y2; y++) { |
becanromain | 0:cf6b1eca3e67 | 1283 | for(x = area->x1; x <= area->x2; x++) { |
becanromain | 0:cf6b1eca3e67 | 1284 | |
becanromain | 0:cf6b1eca3e67 | 1285 | lcd.DrawPixel( x, y, color_p->full); |
becanromain | 0:cf6b1eca3e67 | 1286 | color_p++; |
becanromain | 0:cf6b1eca3e67 | 1287 | } |
becanromain | 0:cf6b1eca3e67 | 1288 | } |
becanromain | 0:cf6b1eca3e67 | 1289 | |
becanromain | 0:cf6b1eca3e67 | 1290 | // IMPORTANT!!! |
becanromain | 0:cf6b1eca3e67 | 1291 | // Inform the graphics library that you are ready with the flushing |
becanromain | 0:cf6b1eca3e67 | 1292 | lv_disp_flush_ready(disp_drv); |
becanromain | 0:cf6b1eca3e67 | 1293 | } |
becanromain | 0:cf6b1eca3e67 | 1294 | |
becanromain | 0:cf6b1eca3e67 | 1295 | //FONCTION RECUPERATION COORDONNEES APPUI |
becanromain | 0:cf6b1eca3e67 | 1296 | bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) |
becanromain | 0:cf6b1eca3e67 | 1297 | { |
becanromain | 0:cf6b1eca3e67 | 1298 | static lv_coord_t last_x = 0; |
becanromain | 0:cf6b1eca3e67 | 1299 | static lv_coord_t last_y = 0; |
becanromain | 0:cf6b1eca3e67 | 1300 | |
becanromain | 0:cf6b1eca3e67 | 1301 | //Save the state and save the pressed coordinate |
becanromain | 0:cf6b1eca3e67 | 1302 | ts.GetState(&TS_State); |
becanromain | 0:cf6b1eca3e67 | 1303 | |
becanromain | 0:cf6b1eca3e67 | 1304 | if(TS_State.touchDetected == 1) { |
becanromain | 0:cf6b1eca3e67 | 1305 | data->state = LV_INDEV_STATE_PR; |
becanromain | 0:cf6b1eca3e67 | 1306 | } else { |
becanromain | 0:cf6b1eca3e67 | 1307 | data->state = LV_INDEV_STATE_REL; |
becanromain | 0:cf6b1eca3e67 | 1308 | } |
becanromain | 0:cf6b1eca3e67 | 1309 | |
becanromain | 0:cf6b1eca3e67 | 1310 | //data->state = tttt ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; |
becanromain | 0:cf6b1eca3e67 | 1311 | // if(data->state == LV_INDEV_STATE_PR){ |
becanromain | 0:cf6b1eca3e67 | 1312 | if(data->state == LV_INDEV_STATE_PR) { |
becanromain | 0:cf6b1eca3e67 | 1313 | //touchpad_get_xy(&last_x, &last_y); |
becanromain | 0:cf6b1eca3e67 | 1314 | last_x = TS_State.touchX[0]; |
becanromain | 0:cf6b1eca3e67 | 1315 | last_y = TS_State.touchY[0]; |
becanromain | 0:cf6b1eca3e67 | 1316 | } |
becanromain | 0:cf6b1eca3e67 | 1317 | |
becanromain | 0:cf6b1eca3e67 | 1318 | //Set the coordinates (if released use the last pressed coordinates) |
becanromain | 0:cf6b1eca3e67 | 1319 | data->point.x = last_x; |
becanromain | 0:cf6b1eca3e67 | 1320 | data->point.y = last_y; |
becanromain | 0:cf6b1eca3e67 | 1321 | |
becanromain | 0:cf6b1eca3e67 | 1322 | X = TS_State.touchDetected ; |
becanromain | 0:cf6b1eca3e67 | 1323 | |
becanromain | 0:cf6b1eca3e67 | 1324 | |
becanromain | 0:cf6b1eca3e67 | 1325 | |
becanromain | 0:cf6b1eca3e67 | 1326 | return false; //Return `false` because we are not buffering and no more data to read |
becanromain | 0:cf6b1eca3e67 | 1327 | } |
becanromain | 0:cf6b1eca3e67 | 1328 |