RET15-01

Dependencies:   BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI eprom mbed

Fork of DISCO-F429ZI_LCDTS_demo by ST

Committer:
Gabriel_2112
Date:
Fri Sep 21 11:29:21 2018 +0000
Revision:
4:cddace170681
Parent:
0:91c6ab790bd7
RET15-01;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:91c6ab790bd7 1 #include "mbed.h"
bcostm 0:91c6ab790bd7 2 #include "TS_DISCO_F429ZI.h"
bcostm 0:91c6ab790bd7 3 #include "LCD_DISCO_F429ZI.h"
Gabriel_2112 4:cddace170681 4 #include "eeprom.h"
Gabriel_2112 4:cddace170681 5
Gabriel_2112 4:cddace170681 6 #define PPV_BOB 1720 // (40/15)*800
Gabriel_2112 4:cddace170681 7 #define PPV_AMA 880 // (
Gabriel_2112 4:cddace170681 8 #define PPMM_AVA 7.8 // 800/103
bcostm 0:91c6ab790bd7 9
bcostm 0:91c6ab790bd7 10 LCD_DISCO_F429ZI lcd;
bcostm 0:91c6ab790bd7 11 TS_DISCO_F429ZI ts;
bcostm 0:91c6ab790bd7 12
Gabriel_2112 4:cddace170681 13 void proc_motores(void);
Gabriel_2112 4:cddace170681 14 void proc_ts(void);
Gabriel_2112 4:cddace170681 15 void tela_principal(void);
Gabriel_2112 4:cddace170681 16
Gabriel_2112 4:cddace170681 17 DigitalOut led(PG_14);
Gabriel_2112 4:cddace170681 18 DigitalOut pulso_cabo(PE_2);
Gabriel_2112 4:cddace170681 19 DigitalOut pulso_ama(PE_3);
Gabriel_2112 4:cddace170681 20 DigitalOut pulso_fit(PE_4);
Gabriel_2112 4:cddace170681 21 DigitalOut dir_ama(PE_5);
Gabriel_2112 4:cddace170681 22 DigitalOut lp_vermelha(PE_6);
Gabriel_2112 4:cddace170681 23 DigitalOut vl_pesca(PB_4);
Gabriel_2112 4:cddace170681 24 DigitalOut vl_corta(PB_7);
Gabriel_2112 4:cddace170681 25 DigitalOut ena_cabo(PF_6);
Gabriel_2112 4:cddace170681 26
Gabriel_2112 4:cddace170681 27 DigitalIn bt_emerg(PC_3);
Gabriel_2112 4:cddace170681 28 DigitalIn bt_pausa(PC_11);
Gabriel_2112 4:cddace170681 29 DigitalIn bt_reset(PC_12);
Gabriel_2112 4:cddace170681 30 DigitalIn bt_posic(PC_13);
Gabriel_2112 4:cddace170681 31 DigitalIn alarm_cabo(PA_5);
Gabriel_2112 4:cddace170681 32 DigitalIn sn_cabo(PA_9);
Gabriel_2112 4:cddace170681 33 DigitalIn sn_ama(PA_10);
Gabriel_2112 4:cddace170681 34 DigitalIn sn_porta(PG_3);
Gabriel_2112 4:cddace170681 35
Gabriel_2112 4:cddace170681 36 Ticker int_ts;
Gabriel_2112 4:cddace170681 37 TS_StateTypeDef TS_State;
Gabriel_2112 4:cddace170681 38
Gabriel_2112 4:cddace170681 39 volatile uint16_t x, y;
Gabriel_2112 4:cddace170681 40 uint8_t PARADA_SERVO = 0;
Gabriel_2112 4:cddace170681 41 uint8_t POSICIONADO = 0;
Gabriel_2112 4:cddace170681 42 uint8_t CONDICAO = 0;
Gabriel_2112 4:cddace170681 43 uint8_t COND_ANT = 0;
Gabriel_2112 4:cddace170681 44
Gabriel_2112 4:cddace170681 45 uint16_t VOLTAS_CABO = 10;
Gabriel_2112 4:cddace170681 46 uint16_t VOLTAS_FIT = 2;
Gabriel_2112 4:cddace170681 47 uint16_t COMP_FIT = 100;
Gabriel_2112 4:cddace170681 48 uint16_t VELO_CABO = 8000;
Gabriel_2112 4:cddace170681 49 uint16_t PRODUCAO = 0;
Gabriel_2112 4:cddace170681 50 float DESLOC = 0;
Gabriel_2112 4:cddace170681 51 char text[10];
Gabriel_2112 4:cddace170681 52 uint16_t VirtAddVarTab[NB_OF_VAR] = {0x0011, 0x0022, 0x0033, 0x0044, 0x0055, 0x0066};
Gabriel_2112 4:cddace170681 53
Gabriel_2112 4:cddace170681 54 void proc_ts(void)
Gabriel_2112 4:cddace170681 55 {
Gabriel_2112 4:cddace170681 56 ts.GetState(&TS_State);
Gabriel_2112 4:cddace170681 57 if (TS_State.TouchDetected)
Gabriel_2112 4:cddace170681 58 {
Gabriel_2112 4:cddace170681 59 x = TS_State.X;
Gabriel_2112 4:cddace170681 60 y = TS_State.Y;
Gabriel_2112 4:cddace170681 61
Gabriel_2112 4:cddace170681 62 //sprintf((char*)text, " %d ", y);
Gabriel_2112 4:cddace170681 63 //lcd.DisplayStringAt(0, 0, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 64 }
Gabriel_2112 4:cddace170681 65 }
Gabriel_2112 4:cddace170681 66
Gabriel_2112 4:cddace170681 67 void RODA_SERVO(uint16_t VL_INICIAL, uint16_t VL_FINAL, uint32_t PASSOS, uint8_t MOTOR)
Gabriel_2112 4:cddace170681 68 {
Gabriel_2112 4:cddace170681 69 PARADA_SERVO = 0;
Gabriel_2112 4:cddace170681 70 uint16_t VELOCIDADE = VL_INICIAL;
Gabriel_2112 4:cddace170681 71 uint32_t PULSOS = 0;
Gabriel_2112 4:cddace170681 72
Gabriel_2112 4:cddace170681 73 POSICIONADO = 0;
Gabriel_2112 4:cddace170681 74
Gabriel_2112 4:cddace170681 75 while (PARADA_SERVO < 1)
Gabriel_2112 4:cddace170681 76 {
Gabriel_2112 4:cddace170681 77 if (VELOCIDADE < VL_FINAL) { if (VELOCIDADE < 8000) { VELOCIDADE+= 2000; } else { VELOCIDADE+= 5; } }
Gabriel_2112 4:cddace170681 78 switch(MOTOR)
Gabriel_2112 4:cddace170681 79 {
Gabriel_2112 4:cddace170681 80 case 0:
Gabriel_2112 4:cddace170681 81 pulso_cabo=1;
Gabriel_2112 4:cddace170681 82 wait_us(30+(10000-VELOCIDADE));
Gabriel_2112 4:cddace170681 83 pulso_cabo=0;
Gabriel_2112 4:cddace170681 84 break;
Gabriel_2112 4:cddace170681 85 case 1:
Gabriel_2112 4:cddace170681 86 pulso_fit=1;
Gabriel_2112 4:cddace170681 87 wait_us(30+(10000-VELOCIDADE));
Gabriel_2112 4:cddace170681 88 pulso_fit=0;
Gabriel_2112 4:cddace170681 89 break;
Gabriel_2112 4:cddace170681 90 case 2:
Gabriel_2112 4:cddace170681 91 pulso_ama=1;
Gabriel_2112 4:cddace170681 92 wait_us(30+(10000-VELOCIDADE));
Gabriel_2112 4:cddace170681 93 pulso_ama=0;
Gabriel_2112 4:cddace170681 94 break;
Gabriel_2112 4:cddace170681 95 case 3:
Gabriel_2112 4:cddace170681 96 pulso_cabo=1;
Gabriel_2112 4:cddace170681 97 wait_us(30+(10000-VELOCIDADE));
Gabriel_2112 4:cddace170681 98 pulso_cabo=0;
Gabriel_2112 4:cddace170681 99 break;
Gabriel_2112 4:cddace170681 100 case 4:
Gabriel_2112 4:cddace170681 101 pulso_ama=1;
Gabriel_2112 4:cddace170681 102 wait_us(30+(10000-VELOCIDADE));
Gabriel_2112 4:cddace170681 103 pulso_ama=0;
Gabriel_2112 4:cddace170681 104 break;
Gabriel_2112 4:cddace170681 105 }
Gabriel_2112 4:cddace170681 106 wait_us(40);
Gabriel_2112 4:cddace170681 107
Gabriel_2112 4:cddace170681 108 PULSOS++;
Gabriel_2112 4:cddace170681 109
Gabriel_2112 4:cddace170681 110 if (PULSOS>PASSOS) { PARADA_SERVO = 1; }
Gabriel_2112 4:cddace170681 111 if (!bt_emerg) { PARADA_SERVO = 2; }
Gabriel_2112 4:cddace170681 112 if (bt_pausa) { PARADA_SERVO = 3; }
Gabriel_2112 4:cddace170681 113 if (!sn_porta) { PARADA_SERVO = 4; }
Gabriel_2112 4:cddace170681 114
Gabriel_2112 4:cddace170681 115 if (MOTOR == 0) // BOBINA
Gabriel_2112 4:cddace170681 116 {
Gabriel_2112 4:cddace170681 117 if ( PULSOS > PASSOS-200) { if (sn_cabo) { PARADA_SERVO = 5; POSICIONADO = 1; } }
Gabriel_2112 4:cddace170681 118 }
Gabriel_2112 4:cddace170681 119
Gabriel_2112 4:cddace170681 120 if (MOTOR == 1) // AVANÇO FITILHO
Gabriel_2112 4:cddace170681 121 {
Gabriel_2112 4:cddace170681 122 //
Gabriel_2112 4:cddace170681 123 }
Gabriel_2112 4:cddace170681 124
Gabriel_2112 4:cddace170681 125 if (MOTOR == 2) // AMARRA FITILHO
Gabriel_2112 4:cddace170681 126 {
Gabriel_2112 4:cddace170681 127 if ( PULSOS > PASSOS-200) { if (sn_ama) { PARADA_SERVO = 5; POSICIONADO = 1; } }
Gabriel_2112 4:cddace170681 128 }
Gabriel_2112 4:cddace170681 129
Gabriel_2112 4:cddace170681 130 if (MOTOR == 3) // REPOSICIONAR BOBINA
Gabriel_2112 4:cddace170681 131 {
Gabriel_2112 4:cddace170681 132 if (sn_cabo) { PARADA_SERVO = 5; }
Gabriel_2112 4:cddace170681 133 }
Gabriel_2112 4:cddace170681 134
Gabriel_2112 4:cddace170681 135 if (MOTOR == 4) // REPOSICIONAR AMARRA
Gabriel_2112 4:cddace170681 136 {
Gabriel_2112 4:cddace170681 137 if (sn_ama) { PARADA_SERVO = 5; }
Gabriel_2112 4:cddace170681 138 }
Gabriel_2112 4:cddace170681 139
Gabriel_2112 4:cddace170681 140 }
Gabriel_2112 4:cddace170681 141
Gabriel_2112 4:cddace170681 142 while (bt_pausa || bt_posic) {}
Gabriel_2112 4:cddace170681 143 }
Gabriel_2112 4:cddace170681 144
Gabriel_2112 4:cddace170681 145 void tela_principal(void)
Gabriel_2112 4:cddace170681 146 {
Gabriel_2112 4:cddace170681 147 //TITULO
Gabriel_2112 4:cddace170681 148 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 149 lcd.Clear(LCD_COLOR_BLUE);
Gabriel_2112 4:cddace170681 150 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 151 lcd.DrawRect(10, 4, 220, 30);
Gabriel_2112 4:cddace170681 152 lcd.SetBackColor(LCD_COLOR_BLUE);
Gabriel_2112 4:cddace170681 153 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 154 lcd.DisplayStringAt(0, 9, (uint8_t *)"RTE15-01", CENTER_MODE);
Gabriel_2112 4:cddace170681 155
Gabriel_2112 4:cddace170681 156 //LABEL PRODUÇÃO
Gabriel_2112 4:cddace170681 157 BSP_LCD_SetFont(&Font20);
Gabriel_2112 4:cddace170681 158 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 159 lcd.DisplayStringAt(0, 60, (uint8_t *)"PRODUCAO", CENTER_MODE);
Gabriel_2112 4:cddace170681 160 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 161
Gabriel_2112 4:cddace170681 162 //QUANTIDADE PRODUZIDA
Gabriel_2112 4:cddace170681 163 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 164 lcd.FillRect(10, 80, 220, 50);
Gabriel_2112 4:cddace170681 165 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 166 lcd.DrawRect(10, 80, 220, 50);
Gabriel_2112 4:cddace170681 167 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 168 lcd.SetTextColor(LCD_COLOR_BLUE);
Gabriel_2112 4:cddace170681 169 lcd.DisplayStringAt(0, 95, (uint8_t *)" 0 ", CENTER_MODE);
Gabriel_2112 4:cddace170681 170
Gabriel_2112 4:cddace170681 171 //BOTÃO ZERAR
Gabriel_2112 4:cddace170681 172 lcd.SetTextColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 173 lcd.FillRect(10, 140, 220, 40);
Gabriel_2112 4:cddace170681 174 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 175 lcd.DrawRect(10, 140, 220, 40);
Gabriel_2112 4:cddace170681 176 lcd.SetBackColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 177 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 178 lcd.DisplayStringAt(0, 150, (uint8_t *)"ZERAR", CENTER_MODE);
Gabriel_2112 4:cddace170681 179
Gabriel_2112 4:cddace170681 180 //STATUS
Gabriel_2112 4:cddace170681 181 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 182 lcd.FillRect(10, 210, 220, 50);
Gabriel_2112 4:cddace170681 183 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 184 lcd.DrawRect(10, 210, 220, 50);
Gabriel_2112 4:cddace170681 185 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 186 lcd.SetTextColor(LCD_COLOR_BLUE);
Gabriel_2112 4:cddace170681 187 lcd.DisplayStringAt(0, 225, (uint8_t *)" PRONTO ", CENTER_MODE);
Gabriel_2112 4:cddace170681 188
Gabriel_2112 4:cddace170681 189 //BOTÃO CONFIG
Gabriel_2112 4:cddace170681 190 lcd.SetTextColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 191 lcd.FillRect(10, 270, 220, 40);
Gabriel_2112 4:cddace170681 192 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 193 lcd.DrawRect(10, 270, 220, 40);
Gabriel_2112 4:cddace170681 194 lcd.SetBackColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 195 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 196 lcd.DisplayStringAt(0, 280, (uint8_t *)"CONFIG.", CENTER_MODE);
Gabriel_2112 4:cddace170681 197
Gabriel_2112 4:cddace170681 198 }
Gabriel_2112 4:cddace170681 199
Gabriel_2112 4:cddace170681 200 void tela_config(void)
Gabriel_2112 4:cddace170681 201 {
Gabriel_2112 4:cddace170681 202 uint8_t sair=0;
Gabriel_2112 4:cddace170681 203 uint16_t _y1 = 38;
Gabriel_2112 4:cddace170681 204 uint16_t _dy = 56;
Gabriel_2112 4:cddace170681 205
Gabriel_2112 4:cddace170681 206 //TÍTULO
Gabriel_2112 4:cddace170681 207 lcd.Clear(LCD_COLOR_GREEN);
Gabriel_2112 4:cddace170681 208 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 209 lcd.DrawRect(10, 4, 220, 30);
Gabriel_2112 4:cddace170681 210 lcd.SetBackColor(LCD_COLOR_GREEN);
Gabriel_2112 4:cddace170681 211 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 212 lcd.DisplayStringAt(0, 9, (uint8_t *)"CONFIG.", CENTER_MODE);
Gabriel_2112 4:cddace170681 213
Gabriel_2112 4:cddace170681 214 //LABEL VOLTAS CABO
Gabriel_2112 4:cddace170681 215 BSP_LCD_SetFont(&Font20);
Gabriel_2112 4:cddace170681 216 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 217 lcd.DisplayStringAt(0, _y1+(_dy*0), (uint8_t *)"VOLTAS CABO", CENTER_MODE);
Gabriel_2112 4:cddace170681 218 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 219
Gabriel_2112 4:cddace170681 220 //VOLTAS CABO
Gabriel_2112 4:cddace170681 221 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 222 lcd.FillRect(40, _y1+(_dy*0)+20, 160, 34);
Gabriel_2112 4:cddace170681 223 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 224 lcd.DrawRect(40, _y1+(_dy*0)+20, 160, 34);
Gabriel_2112 4:cddace170681 225 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 226 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 227 sprintf((char*)text, " %d ", VOLTAS_CABO);
Gabriel_2112 4:cddace170681 228 lcd.DisplayStringAt(0, _y1+(_dy*0)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 229 lcd.FillTriangle(210, 220, 230, _y1+(_dy*0)+34, _y1+(_dy*0)+14, _y1+(_dy*0)+34);
Gabriel_2112 4:cddace170681 230 lcd.FillTriangle(210, 220, 230, _y1+(_dy*0)+40, _y1+(_dy*0)+60, _y1+(_dy*0)+40);
Gabriel_2112 4:cddace170681 231
Gabriel_2112 4:cddace170681 232 //LABEL VOLTAS FITILHO
Gabriel_2112 4:cddace170681 233 BSP_LCD_SetFont(&Font20);
Gabriel_2112 4:cddace170681 234 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 235 lcd.SetBackColor(LCD_COLOR_GREEN);
Gabriel_2112 4:cddace170681 236 lcd.DisplayStringAt(0, _y1+(_dy*1), (uint8_t *)"VOLTAS FIT.", CENTER_MODE);
Gabriel_2112 4:cddace170681 237 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 238
Gabriel_2112 4:cddace170681 239 //VOLTAS FITILHO
Gabriel_2112 4:cddace170681 240 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 241 lcd.FillRect(40, _y1+(_dy*1)+20, 160, 34);
Gabriel_2112 4:cddace170681 242 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 243 lcd.DrawRect(40, _y1+(_dy*1)+20, 160, 34);
Gabriel_2112 4:cddace170681 244 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 245 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 246 sprintf((char*)text, " %d ", VOLTAS_FIT);
Gabriel_2112 4:cddace170681 247 lcd.DisplayStringAt(0, _y1+(_dy*1)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 248 lcd.FillTriangle(210, 220, 230, _y1+(_dy*1)+34, _y1+(_dy*1)+14, _y1+(_dy*1)+34);
Gabriel_2112 4:cddace170681 249 lcd.FillTriangle(210, 220, 230, _y1+(_dy*1)+40, _y1+(_dy*1)+60, _y1+(_dy*1)+40);
Gabriel_2112 4:cddace170681 250
Gabriel_2112 4:cddace170681 251 //LABEL COMP FITILHO
Gabriel_2112 4:cddace170681 252 BSP_LCD_SetFont(&Font20);
Gabriel_2112 4:cddace170681 253 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 254 lcd.SetBackColor(LCD_COLOR_GREEN);
Gabriel_2112 4:cddace170681 255 lcd.DisplayStringAt(0, _y1+(_dy*2), (uint8_t *)"COMP FIT.", CENTER_MODE);
Gabriel_2112 4:cddace170681 256 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 257
Gabriel_2112 4:cddace170681 258 //COMP FITILHO
Gabriel_2112 4:cddace170681 259 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 260 lcd.FillRect(40, _y1+(_dy*2)+20, 160, 34);
Gabriel_2112 4:cddace170681 261 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 262 lcd.DrawRect(40, _y1+(_dy*2)+20, 160, 34);
Gabriel_2112 4:cddace170681 263 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 264 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 265 sprintf((char*)text, " %d ", COMP_FIT);
Gabriel_2112 4:cddace170681 266 lcd.DisplayStringAt(0, _y1+(_dy*2)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 267 lcd.FillTriangle(210, 220, 230, _y1+(_dy*2)+34, _y1+(_dy*2)+14, _y1+(_dy*2)+34);
Gabriel_2112 4:cddace170681 268 lcd.FillTriangle(210, 220, 230, _y1+(_dy*2)+40, _y1+(_dy*2)+60, _y1+(_dy*2)+40);
Gabriel_2112 4:cddace170681 269
Gabriel_2112 4:cddace170681 270 //LABEL VELOCIDADE CABO
Gabriel_2112 4:cddace170681 271 BSP_LCD_SetFont(&Font20);
Gabriel_2112 4:cddace170681 272 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 273 lcd.SetBackColor(LCD_COLOR_GREEN);
Gabriel_2112 4:cddace170681 274 lcd.DisplayStringAt(0, _y1+(_dy*3), (uint8_t *)"VELOC. CABO", CENTER_MODE);
Gabriel_2112 4:cddace170681 275 BSP_LCD_SetFont(&Font24);
Gabriel_2112 4:cddace170681 276
Gabriel_2112 4:cddace170681 277 //COMP FITILHO
Gabriel_2112 4:cddace170681 278 lcd.SetTextColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 279 lcd.FillRect(40, _y1+(_dy*3)+20, 160, 34);
Gabriel_2112 4:cddace170681 280 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 281 lcd.DrawRect(40, _y1+(_dy*3)+20, 160, 34);
Gabriel_2112 4:cddace170681 282 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 283 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 284 sprintf((char*)text, " %d ", VELO_CABO);
Gabriel_2112 4:cddace170681 285 lcd.DisplayStringAt(0, _y1+(_dy*3)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 286 lcd.FillTriangle(210, 220, 230, _y1+(_dy*3)+34, _y1+(_dy*3)+14, _y1+(_dy*3)+34);
Gabriel_2112 4:cddace170681 287 lcd.FillTriangle(210, 220, 230, _y1+(_dy*3)+40, _y1+(_dy*3)+60, _y1+(_dy*3)+40);
Gabriel_2112 4:cddace170681 288
Gabriel_2112 4:cddace170681 289
Gabriel_2112 4:cddace170681 290 //BOTÃO SAIR
Gabriel_2112 4:cddace170681 291 lcd.SetTextColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 292 lcd.FillRect(10, 270, 220, 40);
Gabriel_2112 4:cddace170681 293 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 294 lcd.DrawRect(10, 270, 220, 40);
Gabriel_2112 4:cddace170681 295 lcd.SetBackColor(LCD_COLOR_LIGHTGRAY);
Gabriel_2112 4:cddace170681 296 lcd.SetTextColor(LCD_COLOR_DARKGRAY);
Gabriel_2112 4:cddace170681 297 lcd.DisplayStringAt(0, 280, (uint8_t *)"SAIR", CENTER_MODE);
Gabriel_2112 4:cddace170681 298
Gabriel_2112 4:cddace170681 299 while(sair<1)
Gabriel_2112 4:cddace170681 300 {
Gabriel_2112 4:cddace170681 301
Gabriel_2112 4:cddace170681 302 if(y>(_y1+(_dy*0)+14) && y<(_y1+(_dy*0)+34) && x>200) // + VOLTAS CABO
Gabriel_2112 4:cddace170681 303 {
Gabriel_2112 4:cddace170681 304 y=0; x=0;
Gabriel_2112 4:cddace170681 305 if (VOLTAS_CABO<60)
Gabriel_2112 4:cddace170681 306 {
Gabriel_2112 4:cddace170681 307 VOLTAS_CABO+=5;
Gabriel_2112 4:cddace170681 308 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 309 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 310 sprintf((char*)text, " %d ", VOLTAS_CABO);
Gabriel_2112 4:cddace170681 311 lcd.DisplayStringAt(0, _y1+(_dy*0)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 312 }
Gabriel_2112 4:cddace170681 313 wait(0.3);
Gabriel_2112 4:cddace170681 314 }
Gabriel_2112 4:cddace170681 315
Gabriel_2112 4:cddace170681 316 if(y>(_y1+(_dy*0)+40) && y<(_y1+(_dy*0)+60) && x>200) // - VOLTAS CABO
Gabriel_2112 4:cddace170681 317 {
Gabriel_2112 4:cddace170681 318 y=0; x=0;
Gabriel_2112 4:cddace170681 319 if (VOLTAS_CABO>10)
Gabriel_2112 4:cddace170681 320 {
Gabriel_2112 4:cddace170681 321 VOLTAS_CABO-=5;
Gabriel_2112 4:cddace170681 322 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 323 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 324 sprintf((char*)text, " %d ", VOLTAS_CABO);
Gabriel_2112 4:cddace170681 325 lcd.DisplayStringAt(0, _y1+(_dy*0)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 326 }
Gabriel_2112 4:cddace170681 327 wait(0.3);
Gabriel_2112 4:cddace170681 328 }
Gabriel_2112 4:cddace170681 329
Gabriel_2112 4:cddace170681 330 if(y>(_y1+(_dy*1)+14) && y<(_y1+(_dy*1)+34) && x>200) // + VOLTAS FITILHO
Gabriel_2112 4:cddace170681 331 {
Gabriel_2112 4:cddace170681 332 y=0; x=0;
Gabriel_2112 4:cddace170681 333 if (VOLTAS_FIT<8)
Gabriel_2112 4:cddace170681 334 {
Gabriel_2112 4:cddace170681 335 VOLTAS_FIT+=1;
Gabriel_2112 4:cddace170681 336 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 337 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 338 sprintf((char*)text, " %d ", VOLTAS_FIT);
Gabriel_2112 4:cddace170681 339 lcd.DisplayStringAt(0, _y1+(_dy*1)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 340 }
Gabriel_2112 4:cddace170681 341 wait(0.3);
Gabriel_2112 4:cddace170681 342 }
Gabriel_2112 4:cddace170681 343
Gabriel_2112 4:cddace170681 344 if(y>(_y1+(_dy*1)+40) && y<(_y1+(_dy*1)+60) && x>200) // - VOLTAS FITILHO
Gabriel_2112 4:cddace170681 345 {
Gabriel_2112 4:cddace170681 346 y=0; x=0;
Gabriel_2112 4:cddace170681 347 if (VOLTAS_FIT>2)
Gabriel_2112 4:cddace170681 348 {
Gabriel_2112 4:cddace170681 349 VOLTAS_FIT-=1;
Gabriel_2112 4:cddace170681 350 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 351 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 352 sprintf((char*)text, " %d ", VOLTAS_FIT);
Gabriel_2112 4:cddace170681 353 lcd.DisplayStringAt(0, _y1+(_dy*1)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 354 }
Gabriel_2112 4:cddace170681 355 wait(0.3);
Gabriel_2112 4:cddace170681 356 }
Gabriel_2112 4:cddace170681 357
Gabriel_2112 4:cddace170681 358 if(y>(_y1+(_dy*2)+14) && y<(_y1+(_dy*2)+34) && x>200) // + COMPRIMENTO FITILHO
Gabriel_2112 4:cddace170681 359 {
Gabriel_2112 4:cddace170681 360 y=0; x=0;
Gabriel_2112 4:cddace170681 361 if (COMP_FIT<250)
Gabriel_2112 4:cddace170681 362 {
Gabriel_2112 4:cddace170681 363 COMP_FIT+=1;
Gabriel_2112 4:cddace170681 364 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 365 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 366 sprintf((char*)text, " %d ", COMP_FIT);
Gabriel_2112 4:cddace170681 367 lcd.DisplayStringAt(0, _y1+(_dy*2)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 368 }
Gabriel_2112 4:cddace170681 369 wait(0.1);
Gabriel_2112 4:cddace170681 370 }
Gabriel_2112 4:cddace170681 371
Gabriel_2112 4:cddace170681 372 if(y>(_y1+(_dy*2)+40) && y<(_y1+(_dy*2)+60) && x>200) // - COMPRIMENTO FITILHO
Gabriel_2112 4:cddace170681 373 {
Gabriel_2112 4:cddace170681 374 y=0; x=0;
Gabriel_2112 4:cddace170681 375 if (COMP_FIT>100)
Gabriel_2112 4:cddace170681 376 {
Gabriel_2112 4:cddace170681 377 COMP_FIT-=1;
Gabriel_2112 4:cddace170681 378 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 379 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 380 sprintf((char*)text, " %d ", COMP_FIT);
Gabriel_2112 4:cddace170681 381 lcd.DisplayStringAt(0, _y1+(_dy*2)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 382 }
Gabriel_2112 4:cddace170681 383 wait(0.1);
Gabriel_2112 4:cddace170681 384 }
Gabriel_2112 4:cddace170681 385
Gabriel_2112 4:cddace170681 386 if(y>(_y1+(_dy*3)+14) && y<(_y1+(_dy*3)+34) && x>200) // + VELOCIDADE CABO
Gabriel_2112 4:cddace170681 387 {
Gabriel_2112 4:cddace170681 388 y=0; x=0;
Gabriel_2112 4:cddace170681 389 if (VELO_CABO<9900)
Gabriel_2112 4:cddace170681 390 {
Gabriel_2112 4:cddace170681 391 VELO_CABO+=100;
Gabriel_2112 4:cddace170681 392 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 393 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 394 sprintf((char*)text, " %d ", VELO_CABO);
Gabriel_2112 4:cddace170681 395 lcd.DisplayStringAt(0, _y1+(_dy*3)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 396 }
Gabriel_2112 4:cddace170681 397 wait(0.1);
Gabriel_2112 4:cddace170681 398 }
Gabriel_2112 4:cddace170681 399
Gabriel_2112 4:cddace170681 400 if(y>(_y1+(_dy*3)+40) && y<(_y1+(_dy*3)+60) && x>200) // - VELOCIDADE CABO
Gabriel_2112 4:cddace170681 401 {
Gabriel_2112 4:cddace170681 402 y=0; x=0;
Gabriel_2112 4:cddace170681 403 if (VELO_CABO>4000)
Gabriel_2112 4:cddace170681 404 {
Gabriel_2112 4:cddace170681 405 VELO_CABO-=100;
Gabriel_2112 4:cddace170681 406 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 407 lcd.SetTextColor(LCD_COLOR_BLACK);
Gabriel_2112 4:cddace170681 408 sprintf((char*)text, " %d ", VELO_CABO);
Gabriel_2112 4:cddace170681 409 lcd.DisplayStringAt(0, _y1+(_dy*3)+28, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 410 }
Gabriel_2112 4:cddace170681 411 wait(0.1);
Gabriel_2112 4:cddace170681 412 }
Gabriel_2112 4:cddace170681 413
Gabriel_2112 4:cddace170681 414 if(y>270) // sair
Gabriel_2112 4:cddace170681 415 {
Gabriel_2112 4:cddace170681 416 y=0; x=0;
Gabriel_2112 4:cddace170681 417 EE_WriteVariable(VirtAddVarTab[0], VOLTAS_CABO);
Gabriel_2112 4:cddace170681 418 EE_WriteVariable(VirtAddVarTab[1], VOLTAS_FIT);
Gabriel_2112 4:cddace170681 419 EE_WriteVariable(VirtAddVarTab[2], COMP_FIT);
Gabriel_2112 4:cddace170681 420 EE_WriteVariable(VirtAddVarTab[3], VELO_CABO);
Gabriel_2112 4:cddace170681 421 sair=1;
Gabriel_2112 4:cddace170681 422 }
Gabriel_2112 4:cddace170681 423 }
Gabriel_2112 4:cddace170681 424 }
Gabriel_2112 4:cddace170681 425
Gabriel_2112 4:cddace170681 426 void status(void)
Gabriel_2112 4:cddace170681 427 {
Gabriel_2112 4:cddace170681 428 COND_ANT = CONDICAO;
Gabriel_2112 4:cddace170681 429
Gabriel_2112 4:cddace170681 430 lcd.SetBackColor(LCD_COLOR_WHITE);
Gabriel_2112 4:cddace170681 431 lcd.SetTextColor(LCD_COLOR_BLUE);
Gabriel_2112 4:cddace170681 432
Gabriel_2112 4:cddace170681 433 if (!sn_porta) { CONDICAO = 7; }
Gabriel_2112 4:cddace170681 434 if (!bt_emerg) { CONDICAO = 8; }
Gabriel_2112 4:cddace170681 435
Gabriel_2112 4:cddace170681 436 //CONDICAO = 0;
Gabriel_2112 4:cddace170681 437
Gabriel_2112 4:cddace170681 438 switch (CONDICAO)
Gabriel_2112 4:cddace170681 439 {
Gabriel_2112 4:cddace170681 440 case 0:
Gabriel_2112 4:cddace170681 441 lcd.DisplayStringAt(0, 225, (uint8_t *)" POSICIONAR ", CENTER_MODE);
Gabriel_2112 4:cddace170681 442 lp_vermelha = 0;
Gabriel_2112 4:cddace170681 443 break;
Gabriel_2112 4:cddace170681 444 case 1:
Gabriel_2112 4:cddace170681 445 lcd.DisplayStringAt(0, 225, (uint8_t *)" PRONTO ", CENTER_MODE);
Gabriel_2112 4:cddace170681 446 lp_vermelha = 0;
Gabriel_2112 4:cddace170681 447 break;
Gabriel_2112 4:cddace170681 448 case 6:
Gabriel_2112 4:cddace170681 449 lcd.DisplayStringAt(0, 225, (uint8_t *)" FIM ", CENTER_MODE);
Gabriel_2112 4:cddace170681 450 lp_vermelha = 0;
Gabriel_2112 4:cddace170681 451 break;
Gabriel_2112 4:cddace170681 452 case 7:
Gabriel_2112 4:cddace170681 453 lcd.DisplayStringAt(0, 225, (uint8_t *)"PORTA ABERTA", CENTER_MODE);
Gabriel_2112 4:cddace170681 454 break;
Gabriel_2112 4:cddace170681 455 case 8:
Gabriel_2112 4:cddace170681 456 lcd.DisplayStringAt(0, 225, (uint8_t *)" EMERGENCIA ", CENTER_MODE);
Gabriel_2112 4:cddace170681 457 break;
Gabriel_2112 4:cddace170681 458 default:
Gabriel_2112 4:cddace170681 459 lcd.DisplayStringAt(0, 225, (uint8_t *)"EM TRABALHO ", CENTER_MODE);
Gabriel_2112 4:cddace170681 460 lp_vermelha = 1;
Gabriel_2112 4:cddace170681 461 break;
Gabriel_2112 4:cddace170681 462 }
Gabriel_2112 4:cddace170681 463
Gabriel_2112 4:cddace170681 464 while (CONDICAO == 8)
Gabriel_2112 4:cddace170681 465 {
Gabriel_2112 4:cddace170681 466 lp_vermelha = 1;
Gabriel_2112 4:cddace170681 467 wait(0.4);
Gabriel_2112 4:cddace170681 468 lp_vermelha = 0;
Gabriel_2112 4:cddace170681 469 wait(0.4);
Gabriel_2112 4:cddace170681 470 if (!bt_emerg) { CONDICAO = 8; } else { CONDICAO = 0; }
Gabriel_2112 4:cddace170681 471 }
Gabriel_2112 4:cddace170681 472
Gabriel_2112 4:cddace170681 473 CONDICAO = COND_ANT;
Gabriel_2112 4:cddace170681 474
Gabriel_2112 4:cddace170681 475 if(y>140 && y<180) // ZERAR PRODUÇÃO
Gabriel_2112 4:cddace170681 476 {
Gabriel_2112 4:cddace170681 477 x=0; y=0;
Gabriel_2112 4:cddace170681 478 PRODUCAO = 0;
Gabriel_2112 4:cddace170681 479 EE_WriteVariable(VirtAddVarTab[4], 0);
Gabriel_2112 4:cddace170681 480 }
Gabriel_2112 4:cddace170681 481 sprintf((char*)text, " %d ", PRODUCAO);
Gabriel_2112 4:cddace170681 482 lcd.DisplayStringAt(0, 95, (uint8_t *)&text, CENTER_MODE);
Gabriel_2112 4:cddace170681 483
Gabriel_2112 4:cddace170681 484 if (y>270) // CONFIGURAÇÕES
Gabriel_2112 4:cddace170681 485 {
Gabriel_2112 4:cddace170681 486 x=0; y=0;
Gabriel_2112 4:cddace170681 487 tela_config();
Gabriel_2112 4:cddace170681 488 tela_principal();
Gabriel_2112 4:cddace170681 489 wait(1);
Gabriel_2112 4:cddace170681 490 }
Gabriel_2112 4:cddace170681 491 }
Gabriel_2112 4:cddace170681 492
Gabriel_2112 4:cddace170681 493
bcostm 0:91c6ab790bd7 494 int main()
bcostm 0:91c6ab790bd7 495 {
Gabriel_2112 4:cddace170681 496 int_ts.attach(&proc_ts, 0.05);
Gabriel_2112 4:cddace170681 497 ts.Init(lcd.GetXSize(), lcd.GetYSize());
Gabriel_2112 4:cddace170681 498
Gabriel_2112 4:cddace170681 499 HAL_FLASH_Unlock();
Gabriel_2112 4:cddace170681 500 EE_Init();
Gabriel_2112 4:cddace170681 501 EE_ReadVariable(VirtAddVarTab[0], &VOLTAS_CABO);
Gabriel_2112 4:cddace170681 502 EE_ReadVariable(VirtAddVarTab[1], &VOLTAS_FIT);
Gabriel_2112 4:cddace170681 503 EE_ReadVariable(VirtAddVarTab[2], &COMP_FIT);
Gabriel_2112 4:cddace170681 504 EE_ReadVariable(VirtAddVarTab[3], &VELO_CABO);
Gabriel_2112 4:cddace170681 505 EE_ReadVariable(VirtAddVarTab[4], &PRODUCAO);
Gabriel_2112 4:cddace170681 506
Gabriel_2112 4:cddace170681 507 tela_principal();
Gabriel_2112 4:cddace170681 508
Gabriel_2112 4:cddace170681 509 dir_ama=1;
Gabriel_2112 4:cddace170681 510
Gabriel_2112 4:cddace170681 511 while(true)
bcostm 0:91c6ab790bd7 512 {
Gabriel_2112 4:cddace170681 513 status();
Gabriel_2112 4:cddace170681 514 while (POSICIONADO < 1)
Gabriel_2112 4:cddace170681 515 {
Gabriel_2112 4:cddace170681 516 CONDICAO = 0; status();
bcostm 0:91c6ab790bd7 517
Gabriel_2112 4:cddace170681 518 if ( bt_posic && sn_porta && bt_emerg )
Gabriel_2112 4:cddace170681 519 {
Gabriel_2112 4:cddace170681 520 while (bt_posic) {}
Gabriel_2112 4:cddace170681 521
Gabriel_2112 4:cddace170681 522 ena_cabo=1;
Gabriel_2112 4:cddace170681 523 RODA_SERVO(2000, 9000, PPV_BOB, 3); // REPOSICIONA BOBINA
Gabriel_2112 4:cddace170681 524
Gabriel_2112 4:cddace170681 525 RODA_SERVO(2000, 9000, PPV_AMA, 4); // REPOSICIONA AMARRA
Gabriel_2112 4:cddace170681 526
Gabriel_2112 4:cddace170681 527 if ( sn_cabo && sn_ama ) { POSICIONADO = 1; CONDICAO = 1; status(); }
Gabriel_2112 4:cddace170681 528 }
Gabriel_2112 4:cddace170681 529 }
Gabriel_2112 4:cddace170681 530
Gabriel_2112 4:cddace170681 531 if (!sn_ama) { POSICIONADO = 0; }
Gabriel_2112 4:cddace170681 532
Gabriel_2112 4:cddace170681 533 if ( bt_pausa && sn_porta && bt_emerg )
Gabriel_2112 4:cddace170681 534 {
Gabriel_2112 4:cddace170681 535 while (bt_pausa) {}
bcostm 0:91c6ab790bd7 536
Gabriel_2112 4:cddace170681 537 CONDICAO = 2; status();
Gabriel_2112 4:cddace170681 538 ena_cabo=1;
Gabriel_2112 4:cddace170681 539 wait(0.1);
Gabriel_2112 4:cddace170681 540
Gabriel_2112 4:cddace170681 541 DESLOC = ((float)PPV_BOB*((float)VOLTAS_CABO/10))+200;
Gabriel_2112 4:cddace170681 542 RODA_SERVO(2000, VELO_CABO, (int)DESLOC, 0); // Processa cabo
Gabriel_2112 4:cddace170681 543 if ( PARADA_SERVO == 5 ) // Se parada correta no cabo, continua ciclo
Gabriel_2112 4:cddace170681 544 {
Gabriel_2112 4:cddace170681 545 CONDICAO = 3;
Gabriel_2112 4:cddace170681 546 vl_pesca=1; // Aciona PESCA
Gabriel_2112 4:cddace170681 547 RODA_SERVO(4000, 9000, PPMM_AVA*COMP_FIT, 1); // Processa avanço
Gabriel_2112 4:cddace170681 548 vl_pesca=0; // Recua PESCA
Gabriel_2112 4:cddace170681 549 wait(0.2);
Gabriel_2112 4:cddace170681 550 if ( PARADA_SERVO == 1 ) // Se parada correta do avanço, continua ciclo
Gabriel_2112 4:cddace170681 551 {
Gabriel_2112 4:cddace170681 552 CONDICAO = 4;
Gabriel_2112 4:cddace170681 553 DESLOC = (float)PPV_AMA/2;
Gabriel_2112 4:cddace170681 554 RODA_SERVO(5000, 9900, (int)DESLOC, 1); // Processa pré amarra
Gabriel_2112 4:cddace170681 555 if ( PARADA_SERVO == 1 ) // Se parada correta da pre amarra, continua ciclo
Gabriel_2112 4:cddace170681 556 {
Gabriel_2112 4:cddace170681 557 CONDICAO = 5;
Gabriel_2112 4:cddace170681 558 vl_corta=1; // Aciona FACA
Gabriel_2112 4:cddace170681 559 DESLOC = ((PPV_AMA*VOLTAS_FIT)-(float)PPV_AMA/2)+200;
Gabriel_2112 4:cddace170681 560 RODA_SERVO(5000, 9900, (int)DESLOC, 2); // Processa restante da amarra
Gabriel_2112 4:cddace170681 561 vl_corta=0;
Gabriel_2112 4:cddace170681 562 if ( PARADA_SERVO == 5 ) { CONDICAO = 6; PRODUCAO++; EE_WriteVariable(VirtAddVarTab[4], PRODUCAO); status(); } // Se parada correta da amarra, indica FIM (Condição 6)
Gabriel_2112 4:cddace170681 563 while (sn_porta){} // Espera abrir a porta
Gabriel_2112 4:cddace170681 564 CONDICAO = 1; status();
Gabriel_2112 4:cddace170681 565 }
Gabriel_2112 4:cddace170681 566 }
Gabriel_2112 4:cddace170681 567 }
Gabriel_2112 4:cddace170681 568 vl_corta=0; // Recua FACA
Gabriel_2112 4:cddace170681 569 vl_pesca=0; // Recua PESCA
Gabriel_2112 4:cddace170681 570 }
Gabriel_2112 4:cddace170681 571
bcostm 0:91c6ab790bd7 572 }
Gabriel_2112 4:cddace170681 573 }