Felícito Manzano
/
DTK_Guaria2_ABInBev
Proyecto ABInBev para la tarjeta Guaria 1/2.
Program/eeprom_exe.cpp@18:522f706f03b1, 2022-07-07 (annotated)
- Committer:
- fmanzano_dtk
- Date:
- Thu Jul 07 08:56:13 2022 -0600
- Revision:
- 18:522f706f03b1
- Parent:
- 10:a0005a4116ae
Actualizacion
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fmanzano_dtk | 5:07720e3f99d2 | 1 | /** |
fmanzano_dtk | 5:07720e3f99d2 | 2 | * @file flash_exe.cpp |
fmanzano_dtk | 5:07720e3f99d2 | 3 | * @author Felícito Manzano (felicito.manzano@detektor.com.sv) |
fmanzano_dtk | 5:07720e3f99d2 | 4 | * @brief |
fmanzano_dtk | 5:07720e3f99d2 | 5 | * @version 0.1 |
fmanzano_dtk | 5:07720e3f99d2 | 6 | * @date 2021-02-08 |
fmanzano_dtk | 5:07720e3f99d2 | 7 | * |
fmanzano_dtk | 5:07720e3f99d2 | 8 | * @copyright Copyright (c) 2021 |
fmanzano_dtk | 5:07720e3f99d2 | 9 | * |
fmanzano_dtk | 5:07720e3f99d2 | 10 | */ |
fmanzano_dtk | 5:07720e3f99d2 | 11 | |
fmanzano_dtk | 5:07720e3f99d2 | 12 | #include "mbed.h" |
fmanzano_dtk | 5:07720e3f99d2 | 13 | #include "eeprom_exe.hpp" |
fmanzano_dtk | 5:07720e3f99d2 | 14 | #include "eeprom.h" |
fmanzano_dtk | 5:07720e3f99d2 | 15 | #include "USBSerial.h" |
fmanzano_dtk | 5:07720e3f99d2 | 16 | #include <ctype.h> |
fmanzano_dtk | 5:07720e3f99d2 | 17 | |
fmanzano_dtk | 5:07720e3f99d2 | 18 | /** * INTERFACES * **/ |
fmanzano_dtk | 5:07720e3f99d2 | 19 | extern USBSerial myPC_debug; |
fmanzano_dtk | 5:07720e3f99d2 | 20 | extern DigitalOut flashLED; |
fmanzano_dtk | 5:07720e3f99d2 | 21 | extern EEPROM ep; |
fmanzano_dtk | 5:07720e3f99d2 | 22 | |
fmanzano_dtk | 5:07720e3f99d2 | 23 | /** * VARIABLES * **/ |
fmanzano_dtk | 5:07720e3f99d2 | 24 | // Manejo de EEPROM FLASH |
fmanzano_dtk | 5:07720e3f99d2 | 25 | uint32_t eprom_AddressArray[] = { |
fmanzano_dtk | 5:07720e3f99d2 | 26 | EE_Address_FINGERPRINT, |
fmanzano_dtk | 5:07720e3f99d2 | 27 | EE_Address_OVERRIDE_FP, |
fmanzano_dtk | 5:07720e3f99d2 | 28 | EE_Address_OVERRIDE_LIMIT, |
fmanzano_dtk | 5:07720e3f99d2 | 29 | EE_Address_IDLE_SHUTDOWN, |
fmanzano_dtk | 5:07720e3f99d2 | 30 | EE_Address_IDLE_REMINDER, |
fmanzano_dtk | 5:07720e3f99d2 | 31 | EE_Address_IDLE_S_TIME, |
fmanzano_dtk | 5:07720e3f99d2 | 32 | EE_Address_IDLE_R_TIME, |
fmanzano_dtk | 5:07720e3f99d2 | 33 | EE_Address_SEATBELT_READ, |
fmanzano_dtk | 5:07720e3f99d2 | 34 | EE_Address_ENFORCE_SB, |
fmanzano_dtk | 5:07720e3f99d2 | 35 | EE_Address_PILOT_BTYPE, |
fmanzano_dtk | 5:07720e3f99d2 | 36 | EE_Address_COPILOT_BTYPE, |
fmanzano_dtk | 5:07720e3f99d2 | 37 | EE_Address_CREW_BTYPE, |
fmanzano_dtk | 5:07720e3f99d2 | 38 | EE_Address_RAINSENSOR, |
fmanzano_dtk | 5:07720e3f99d2 | 39 | EE_Address_RS_SILENTMODE, |
fmanzano_dtk | 5:07720e3f99d2 | 40 | EE_Address_RS_SAMPLE_T, |
fmanzano_dtk | 5:07720e3f99d2 | 41 | EE_Address_WET_LIMIT, |
fmanzano_dtk | 5:07720e3f99d2 | 42 | EE_Address_WET_WARNING, |
fmanzano_dtk | 5:07720e3f99d2 | 43 | EE_Address_DRY_LIMIT, |
fmanzano_dtk | 5:07720e3f99d2 | 44 | EE_Address_DRY_WARNING, |
fmanzano_dtk | 5:07720e3f99d2 | 45 | EE_Address_SAFETY_TIP, |
fmanzano_dtk | 5:07720e3f99d2 | 46 | EE_Address_SAFETY_TIP_T, |
fmanzano_dtk | 5:07720e3f99d2 | 47 | EE_Address_GEOZONE, |
fmanzano_dtk | 5:07720e3f99d2 | 48 | EE_Address_VOLUME, |
fmanzano_dtk | 5:07720e3f99d2 | 49 | EE_Address_BLE_RESET, |
fmanzano_dtk | 5:07720e3f99d2 | 50 | EE_Address_BLE_RESET_T, |
fmanzano_dtk | 5:07720e3f99d2 | 51 | EE_Address_FINGERPRINT_RE |
fmanzano_dtk | 5:07720e3f99d2 | 52 | }; |
fmanzano_dtk | 5:07720e3f99d2 | 53 | |
fmanzano_dtk | 5:07720e3f99d2 | 54 | // Lector de Huellas |
fmanzano_dtk | 5:07720e3f99d2 | 55 | extern bool functionality_fingerprint_reader; |
fmanzano_dtk | 5:07720e3f99d2 | 56 | extern bool fingerprint_remotly_disable; |
fmanzano_dtk | 5:07720e3f99d2 | 57 | extern bool fingerprint_override; |
fmanzano_dtk | 5:07720e3f99d2 | 58 | extern int fp_override_limit; // 4 intentos |
fmanzano_dtk | 5:07720e3f99d2 | 59 | |
fmanzano_dtk | 5:07720e3f99d2 | 60 | // Ralentí |
fmanzano_dtk | 5:07720e3f99d2 | 61 | extern bool functionality_idle_shutdown; |
fmanzano_dtk | 5:07720e3f99d2 | 62 | extern bool functionality_idle_reminder; |
fmanzano_dtk | 5:07720e3f99d2 | 63 | extern float wait_idle_shutdown; //600.0 segundos |
fmanzano_dtk | 5:07720e3f99d2 | 64 | extern float wait_idle_reminder; // 180.0 segundos |
fmanzano_dtk | 5:07720e3f99d2 | 65 | |
fmanzano_dtk | 5:07720e3f99d2 | 66 | // Cinturones |
fmanzano_dtk | 5:07720e3f99d2 | 67 | extern bool functionality_seatbelt_reading; |
fmanzano_dtk | 5:07720e3f99d2 | 68 | extern bool functionality_force_driver_buclke; |
fmanzano_dtk | 5:07720e3f99d2 | 69 | extern bool pilot_buckle_type; |
fmanzano_dtk | 5:07720e3f99d2 | 70 | extern int pilot_buckleUp; |
fmanzano_dtk | 5:07720e3f99d2 | 71 | extern int pilot_unfasten; |
fmanzano_dtk | 5:07720e3f99d2 | 72 | extern bool copilot_buckle_type; |
fmanzano_dtk | 5:07720e3f99d2 | 73 | extern int copilot_buckleUp; |
fmanzano_dtk | 5:07720e3f99d2 | 74 | extern int copilot_unfasten; |
fmanzano_dtk | 5:07720e3f99d2 | 75 | extern bool crew_buckle_type; |
fmanzano_dtk | 5:07720e3f99d2 | 76 | extern int crew_buckleUp; |
fmanzano_dtk | 5:07720e3f99d2 | 77 | extern int crew_unfasten; |
fmanzano_dtk | 5:07720e3f99d2 | 78 | |
fmanzano_dtk | 5:07720e3f99d2 | 79 | // Sensor de Lluvia |
fmanzano_dtk | 5:07720e3f99d2 | 80 | extern bool functionality_rain_sensor; |
fmanzano_dtk | 5:07720e3f99d2 | 81 | extern bool functionality_rainSensor_silentMode; |
fmanzano_dtk | 5:07720e3f99d2 | 82 | extern float time_sample_rain; // 6.0 segundos |
fmanzano_dtk | 5:07720e3f99d2 | 83 | |
fmanzano_dtk | 5:07720e3f99d2 | 84 | // Limites de Velocidad en Mojado y seco |
fmanzano_dtk | 5:07720e3f99d2 | 85 | extern int wet_Speed_Warning; // 50 Km/h |
fmanzano_dtk | 5:07720e3f99d2 | 86 | extern int wet_Speed_Limit; // 55 Km/h |
fmanzano_dtk | 5:07720e3f99d2 | 87 | extern int dry_Speed_Warning; // 70 Km/h |
fmanzano_dtk | 5:07720e3f99d2 | 88 | extern int dry_Speed_Limit; // 80 Km/h |
fmanzano_dtk | 5:07720e3f99d2 | 89 | |
fmanzano_dtk | 5:07720e3f99d2 | 90 | // Tip de Seguridad y Geocercas |
fmanzano_dtk | 5:07720e3f99d2 | 91 | extern bool functionality_geo_warning; |
fmanzano_dtk | 5:07720e3f99d2 | 92 | extern bool functionality_safety_tip; |
fmanzano_dtk | 5:07720e3f99d2 | 93 | extern float time_safety_tip; // 900.0 segundos |
fmanzano_dtk | 5:07720e3f99d2 | 94 | |
fmanzano_dtk | 5:07720e3f99d2 | 95 | // Volumen de Parlante |
fmanzano_dtk | 5:07720e3f99d2 | 96 | extern int temp_JQ8400_Volume; // 4 HIGH |
fmanzano_dtk | 5:07720e3f99d2 | 97 | |
fmanzano_dtk | 5:07720e3f99d2 | 98 | // Autoreset de BLE |
fmanzano_dtk | 5:07720e3f99d2 | 99 | extern bool functionality_ble_autoreset; |
fmanzano_dtk | 5:07720e3f99d2 | 100 | extern float time_ble_autoreset; |
fmanzano_dtk | 5:07720e3f99d2 | 101 | |
fmanzano_dtk | 5:07720e3f99d2 | 102 | #define DEBUG_FLASH_CPP |
fmanzano_dtk | 5:07720e3f99d2 | 103 | |
fmanzano_dtk | 5:07720e3f99d2 | 104 | /** |
fmanzano_dtk | 5:07720e3f99d2 | 105 | * @brief |
fmanzano_dtk | 5:07720e3f99d2 | 106 | * |
fmanzano_dtk | 5:07720e3f99d2 | 107 | */ |
fmanzano_dtk | 5:07720e3f99d2 | 108 | void load_eepromVar() { |
fmanzano_dtk | 5:07720e3f99d2 | 109 | //myPC_debug.printf("\r\n FLASH - Cargando datos en Variables..."); |
fmanzano_dtk | 5:07720e3f99d2 | 110 | int16_t tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 111 | |
fmanzano_dtk | 5:07720e3f99d2 | 112 | // Lector de Huellas |
fmanzano_dtk | 5:07720e3f99d2 | 113 | ep.read(eprom_AddressArray[EE_Address_FINGERPRINT], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 114 | functionality_fingerprint_reader = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 115 | |
fmanzano_dtk | 5:07720e3f99d2 | 116 | ep.read(eprom_AddressArray[EE_Address_FINGERPRINT_RE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 117 | fingerprint_remotly_disable = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 118 | |
fmanzano_dtk | 5:07720e3f99d2 | 119 | ep.read(eprom_AddressArray[EE_Address_OVERRIDE_FP], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 120 | fingerprint_override = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 121 | |
fmanzano_dtk | 5:07720e3f99d2 | 122 | ep.read(eprom_AddressArray[EE_Address_OVERRIDE_LIMIT], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 123 | fp_override_limit = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 124 | |
fmanzano_dtk | 5:07720e3f99d2 | 125 | // Ralentí |
fmanzano_dtk | 5:07720e3f99d2 | 126 | ep.read(eprom_AddressArray[EE_Address_IDLE_SHUTDOWN], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 127 | functionality_idle_shutdown = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 128 | |
fmanzano_dtk | 5:07720e3f99d2 | 129 | ep.read(eprom_AddressArray[EE_Address_IDLE_REMINDER], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 130 | functionality_idle_reminder = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 131 | |
fmanzano_dtk | 5:07720e3f99d2 | 132 | ep.read(eprom_AddressArray[EE_Address_IDLE_S_TIME], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 133 | wait_idle_shutdown = ((int) tempData) * 1.0; |
fmanzano_dtk | 5:07720e3f99d2 | 134 | |
fmanzano_dtk | 5:07720e3f99d2 | 135 | ep.read(eprom_AddressArray[EE_Address_IDLE_R_TIME], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 136 | wait_idle_reminder = ((int) tempData) * 1.0; |
fmanzano_dtk | 5:07720e3f99d2 | 137 | |
fmanzano_dtk | 5:07720e3f99d2 | 138 | // Sensor de Lluvia |
fmanzano_dtk | 5:07720e3f99d2 | 139 | ep.read(eprom_AddressArray[EE_Address_RAINSENSOR], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 140 | functionality_rain_sensor = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 141 | |
fmanzano_dtk | 5:07720e3f99d2 | 142 | ep.read(eprom_AddressArray[EE_Address_RS_SILENTMODE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 143 | functionality_rainSensor_silentMode = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 144 | |
fmanzano_dtk | 5:07720e3f99d2 | 145 | ep.read(eprom_AddressArray[EE_Address_RS_SAMPLE_T], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 146 | time_sample_rain = ((int) tempData) * 1.0; |
fmanzano_dtk | 5:07720e3f99d2 | 147 | |
fmanzano_dtk | 5:07720e3f99d2 | 148 | // Limites de Velocidad en Mojado y seco |
fmanzano_dtk | 5:07720e3f99d2 | 149 | ep.read(eprom_AddressArray[EE_Address_WET_WARNING], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 150 | wet_Speed_Warning = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 151 | |
fmanzano_dtk | 5:07720e3f99d2 | 152 | ep.read(eprom_AddressArray[EE_Address_WET_LIMIT], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 153 | wet_Speed_Limit = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 154 | |
fmanzano_dtk | 5:07720e3f99d2 | 155 | ep.read(eprom_AddressArray[EE_Address_DRY_WARNING], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 156 | dry_Speed_Warning = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 157 | |
fmanzano_dtk | 5:07720e3f99d2 | 158 | ep.read(eprom_AddressArray[EE_Address_DRY_LIMIT], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 159 | dry_Speed_Limit = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 160 | |
fmanzano_dtk | 5:07720e3f99d2 | 161 | // Tip de Seguridad y Geocercas |
fmanzano_dtk | 5:07720e3f99d2 | 162 | ep.read(eprom_AddressArray[EE_Address_SAFETY_TIP], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 163 | functionality_safety_tip = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 164 | |
fmanzano_dtk | 5:07720e3f99d2 | 165 | ep.read(eprom_AddressArray[EE_Address_SAFETY_TIP_T], tempData); // 900.0 segundos |
fmanzano_dtk | 5:07720e3f99d2 | 166 | time_safety_tip = ((int) tempData) * 1.0; |
fmanzano_dtk | 5:07720e3f99d2 | 167 | |
fmanzano_dtk | 5:07720e3f99d2 | 168 | ep.read(eprom_AddressArray[EE_Address_GEOZONE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 169 | functionality_geo_warning = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 170 | |
fmanzano_dtk | 5:07720e3f99d2 | 171 | // Volumen de Parlante |
fmanzano_dtk | 5:07720e3f99d2 | 172 | ep.read(eprom_AddressArray[EE_Address_VOLUME], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 173 | temp_JQ8400_Volume = (int) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 174 | |
fmanzano_dtk | 5:07720e3f99d2 | 175 | // Autoreset BLE |
fmanzano_dtk | 5:07720e3f99d2 | 176 | ep.read(eprom_AddressArray[EE_Address_BLE_RESET], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 177 | functionality_ble_autoreset = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 178 | |
fmanzano_dtk | 5:07720e3f99d2 | 179 | ep.read(eprom_AddressArray[EE_Address_BLE_RESET_T], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 180 | time_ble_autoreset = ((int) tempData) * 1.0; |
fmanzano_dtk | 5:07720e3f99d2 | 181 | |
fmanzano_dtk | 5:07720e3f99d2 | 182 | // Cinturones |
fmanzano_dtk | 5:07720e3f99d2 | 183 | ep.read(eprom_AddressArray[EE_Address_SEATBELT_READ], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 184 | functionality_seatbelt_reading = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 185 | |
fmanzano_dtk | 5:07720e3f99d2 | 186 | ep.read(eprom_AddressArray[EE_Address_ENFORCE_SB], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 187 | functionality_force_driver_buclke = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 188 | |
fmanzano_dtk | 5:07720e3f99d2 | 189 | ep.read(eprom_AddressArray[EE_Address_PILOT_BTYPE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 190 | pilot_buckle_type = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 191 | |
fmanzano_dtk | 5:07720e3f99d2 | 192 | ep.read(eprom_AddressArray[EE_Address_COPILOT_BTYPE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 193 | copilot_buckle_type = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 194 | |
fmanzano_dtk | 5:07720e3f99d2 | 195 | ep.read(eprom_AddressArray[EE_Address_CREW_BTYPE], tempData); |
fmanzano_dtk | 5:07720e3f99d2 | 196 | crew_buckle_type = (bool) tempData; |
fmanzano_dtk | 5:07720e3f99d2 | 197 | |
fmanzano_dtk | 5:07720e3f99d2 | 198 | // Pilot Seatbelt Buckle Type Definition |
fmanzano_dtk | 5:07720e3f99d2 | 199 | if (pilot_buckle_type) { // N.O. - Honduras |
fmanzano_dtk | 5:07720e3f99d2 | 200 | pilot_buckleUp = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 201 | pilot_unfasten = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 202 | } else { // N.C. - Panamá |
fmanzano_dtk | 5:07720e3f99d2 | 203 | pilot_buckleUp = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 204 | pilot_unfasten = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 205 | } |
fmanzano_dtk | 5:07720e3f99d2 | 206 | |
fmanzano_dtk | 5:07720e3f99d2 | 207 | // Copilot Seatbelt Buckle Type Definition |
fmanzano_dtk | 5:07720e3f99d2 | 208 | if (copilot_buckle_type) { // N.O. - Honduras |
fmanzano_dtk | 5:07720e3f99d2 | 209 | copilot_buckleUp = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 210 | copilot_unfasten = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 211 | } else { // N.C. - Panamá |
fmanzano_dtk | 5:07720e3f99d2 | 212 | copilot_buckleUp = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 213 | copilot_unfasten = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 214 | } |
fmanzano_dtk | 5:07720e3f99d2 | 215 | |
fmanzano_dtk | 5:07720e3f99d2 | 216 | // Crew Seatbelt Buckle Type Definition |
fmanzano_dtk | 5:07720e3f99d2 | 217 | if (crew_buckle_type) { // N.O. - Honduras |
fmanzano_dtk | 5:07720e3f99d2 | 218 | crew_buckleUp = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 219 | crew_unfasten = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 220 | } else { // N.C. - Panamá |
fmanzano_dtk | 5:07720e3f99d2 | 221 | crew_buckleUp = -1; |
fmanzano_dtk | 5:07720e3f99d2 | 222 | crew_unfasten = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 223 | } |
fmanzano_dtk | 5:07720e3f99d2 | 224 | |
fmanzano_dtk | 5:07720e3f99d2 | 225 | #ifdef DEBUG_FLASH_CPP |
fmanzano_dtk | 5:07720e3f99d2 | 226 | myPC_debug.printf("\r\n FLASH - Completado!"); |
fmanzano_dtk | 5:07720e3f99d2 | 227 | myPC_debug.printf("\r\n FLASH - Valores cargados:"); |
fmanzano_dtk | 5:07720e3f99d2 | 228 | myPC_debug.printf("\r\n Lector de Huellas: %s", functionality_fingerprint_reader?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 229 | myPC_debug.printf("\r\n Lector de Huellas Deshabilitado Remoto: %s", functionality_fingerprint_reader?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 230 | myPC_debug.printf("\r\n Anulacion de Lector: %s", fingerprint_override?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 231 | myPC_debug.printf("\r\n Cantidad para Anulacion: %d\r\n", fp_override_limit); |
fmanzano_dtk | 5:07720e3f99d2 | 232 | myPC_debug.printf("\r\n Apagado por Ralenti: %s", functionality_idle_shutdown?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 233 | myPC_debug.printf("\r\n Recordatorio de Ralenti: %s", functionality_idle_reminder?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 234 | myPC_debug.printf("\r\n Tiempo Apagado por Ralenti: %.1f", wait_idle_shutdown); |
fmanzano_dtk | 5:07720e3f99d2 | 235 | myPC_debug.printf("\r\n Tiempo Recordatorio de Ralenti: %.1f\r\n", wait_idle_reminder); |
fmanzano_dtk | 5:07720e3f99d2 | 236 | myPC_debug.printf("\r\n Lectura de Cinturones: %s", functionality_seatbelt_reading?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 237 | myPC_debug.printf("\r\n Forzar Conductor Abrochado: %s\r\n", functionality_force_driver_buclke?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 238 | myPC_debug.printf("\r\n Tipo de Hebilla Piloto: %s", pilot_buckle_type?"N. OPEN":"N. CLOSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 239 | myPC_debug.printf("\r\n Tipo de Hebilla Copiloto: %s", copilot_buckle_type?"N. OPEN":"N. CLOSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 240 | myPC_debug.printf("\r\n Tipo de Hebilla Tripulante: %s", crew_buckle_type?"N. OPEN":"N. CLOSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 241 | myPC_debug.printf("\r\n Sensor de Lluvia: %s", functionality_rain_sensor?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 242 | myPC_debug.printf("\r\n Modo Silencioso de Lluvia: %s", functionality_rainSensor_silentMode?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 243 | myPC_debug.printf("\r\n Temporizador para Lluvia: %.1f\r\n", time_sample_rain); |
fmanzano_dtk | 5:07720e3f99d2 | 244 | myPC_debug.printf("\r\n Advertencia Mojado: %d", wet_Speed_Warning); |
fmanzano_dtk | 5:07720e3f99d2 | 245 | myPC_debug.printf("\r\n Limite Mojado: %d", wet_Speed_Limit); |
fmanzano_dtk | 5:07720e3f99d2 | 246 | myPC_debug.printf("\r\n Advertencia Seco: %d", dry_Speed_Warning); |
fmanzano_dtk | 5:07720e3f99d2 | 247 | myPC_debug.printf("\r\n Limite Seco: %d\r\n", dry_Speed_Limit); |
fmanzano_dtk | 5:07720e3f99d2 | 248 | myPC_debug.printf("\r\n Notificacion Geocerca: %s", functionality_geo_warning?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 249 | myPC_debug.printf("\r\n Tip de Seguridad: %s", functionality_safety_tip?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 250 | myPC_debug.printf("\r\n Tiempo entre Tip de Seguridad: %.1f\r\n", time_safety_tip); |
fmanzano_dtk | 5:07720e3f99d2 | 251 | myPC_debug.printf("\r\n Volumen Parlante: %d\r\n", temp_JQ8400_Volume); |
fmanzano_dtk | 5:07720e3f99d2 | 252 | myPC_debug.printf("\r\n BLE Autoreset: %s", functionality_ble_autoreset?"TRUE":"FALSE"); |
fmanzano_dtk | 5:07720e3f99d2 | 253 | myPC_debug.printf("\r\n BLE Temporizador: %.1f\r\n\r\n", time_ble_autoreset); |
fmanzano_dtk | 5:07720e3f99d2 | 254 | #endif |
fmanzano_dtk | 5:07720e3f99d2 | 255 | } |
fmanzano_dtk | 5:07720e3f99d2 | 256 | |
fmanzano_dtk | 5:07720e3f99d2 | 257 | void eeprom_Default() { |
fmanzano_dtk | 5:07720e3f99d2 | 258 | |
fmanzano_dtk | 5:07720e3f99d2 | 259 | //myPC_debug.printf("\r\n FLASH - Cargando valores por defecto"); |
fmanzano_dtk | 5:07720e3f99d2 | 260 | #define SEATBELT_CONFIG 7 |
fmanzano_dtk | 5:07720e3f99d2 | 261 | |
fmanzano_dtk | 5:07720e3f99d2 | 262 | ep.write(eprom_AddressArray[EE_Address_FINGERPRINT], ((uint16_t) true)); // Fingerprint Enable |
fmanzano_dtk | 5:07720e3f99d2 | 263 | ep.write(eprom_AddressArray[EE_Address_OVERRIDE_FP], ((uint16_t) true)); // Override Fingerprint Authentication |
fmanzano_dtk | 5:07720e3f99d2 | 264 | ep.write(eprom_AddressArray[EE_Address_OVERRIDE_LIMIT], ((uint16_t) 4)); // Override Fingerprint Quantity |
fmanzano_dtk | 10:a0005a4116ae | 265 | ep.write(eprom_AddressArray[EE_Address_IDLE_SHUTDOWN], ((uint16_t) true)); // Idle Shutdown Enable |
fmanzano_dtk | 5:07720e3f99d2 | 266 | ep.write(eprom_AddressArray[EE_Address_IDLE_REMINDER], ((uint16_t) true)); // Idle Shutdown Reminder |
fmanzano_dtk | 10:a0005a4116ae | 267 | ep.write(eprom_AddressArray[EE_Address_IDLE_S_TIME], ((uint16_t) 600)); // Idle Shutdown Cutoff Time |
fmanzano_dtk | 5:07720e3f99d2 | 268 | ep.write(eprom_AddressArray[EE_Address_IDLE_R_TIME], ((uint16_t) 180)); // Idle Shutdown Reminder Time |
fmanzano_dtk | 5:07720e3f99d2 | 269 | ep.write(eprom_AddressArray[EE_Address_SEATBELT_READ], ((uint16_t) true)); // Seatbelt reading Enable |
fmanzano_dtk | 5:07720e3f99d2 | 270 | ep.write(eprom_AddressArray[EE_Address_ENFORCE_SB], ((uint16_t) true)); // Force Driver Buckleup |
fmanzano_dtk | 5:07720e3f99d2 | 271 | #if (SEATBELT_CONFIG == 0) |
fmanzano_dtk | 5:07720e3f99d2 | 272 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 273 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 274 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 275 | #elif (SEATBELT_CONFIG == 1) |
fmanzano_dtk | 5:07720e3f99d2 | 276 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 277 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 278 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 279 | #elif (SEATBELT_CONFIG == 2) |
fmanzano_dtk | 5:07720e3f99d2 | 280 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 281 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 282 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 283 | #elif (SEATBELT_CONFIG == 3) |
fmanzano_dtk | 5:07720e3f99d2 | 284 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 285 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 286 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 287 | #elif (SEATBELT_CONFIG == 4) |
fmanzano_dtk | 5:07720e3f99d2 | 288 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 289 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 290 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 291 | #elif (SEATBELT_CONFIG == 5) |
fmanzano_dtk | 5:07720e3f99d2 | 292 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 293 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 294 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 295 | #elif (SEATBELT_CONFIG == 6) |
fmanzano_dtk | 5:07720e3f99d2 | 296 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 297 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 298 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) false)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 299 | #elif (SEATBELT_CONFIG == 7) |
fmanzano_dtk | 5:07720e3f99d2 | 300 | ep.write(eprom_AddressArray[EE_Address_PILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 301 | ep.write(eprom_AddressArray[EE_Address_COPILOT_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 302 | ep.write(eprom_AddressArray[EE_Address_CREW_BTYPE], ((uint16_t) true)); // Seatbelt reading Type (FALSE = PA | TRUE = HN) |
fmanzano_dtk | 5:07720e3f99d2 | 303 | #endif |
fmanzano_dtk | 5:07720e3f99d2 | 304 | ep.write(eprom_AddressArray[EE_Address_RAINSENSOR], ((uint16_t) true)); // Rain Sensor Enable |
fmanzano_dtk | 10:a0005a4116ae | 305 | ep.write(eprom_AddressArray[EE_Address_RS_SILENTMODE], ((uint16_t) false)); // Silent mode Rain Sensor |
fmanzano_dtk | 5:07720e3f99d2 | 306 | ep.write(eprom_AddressArray[EE_Address_RS_SAMPLE_T], ((uint16_t) 6)); // Sample Time Rain Sensor |
fmanzano_dtk | 5:07720e3f99d2 | 307 | ep.write(eprom_AddressArray[EE_Address_WET_LIMIT], ((uint16_t) 55)); // Wet Speed Limit |
fmanzano_dtk | 5:07720e3f99d2 | 308 | ep.write(eprom_AddressArray[EE_Address_WET_WARNING], ((uint16_t) 50)); // Wet Speed Warning |
fmanzano_dtk | 5:07720e3f99d2 | 309 | ep.write(eprom_AddressArray[EE_Address_DRY_LIMIT], ((uint16_t) 80)); // Dry Speed Limit |
fmanzano_dtk | 5:07720e3f99d2 | 310 | ep.write(eprom_AddressArray[EE_Address_DRY_WARNING], ((uint16_t) 70)); // Dry Speed Warning |
fmanzano_dtk | 10:a0005a4116ae | 311 | ep.write(eprom_AddressArray[EE_Address_SAFETY_TIP], ((uint16_t) true)); // Enable Safety Tip |
fmanzano_dtk | 10:a0005a4116ae | 312 | ep.write(eprom_AddressArray[EE_Address_SAFETY_TIP_T], ((uint16_t) 1800)); // Time for Safety Tip |
fmanzano_dtk | 5:07720e3f99d2 | 313 | ep.write(eprom_AddressArray[EE_Address_GEOZONE], ((uint16_t) false)); // Geozone alert |
fmanzano_dtk | 10:a0005a4116ae | 314 | ep.write(eprom_AddressArray[EE_Address_VOLUME], ((uint16_t) 5)); // Volume Level 6=Maximum |
fmanzano_dtk | 5:07720e3f99d2 | 315 | ep.write(eprom_AddressArray[EE_Address_BLE_RESET], ((uint16_t) true)); // BLE Autoreset |
fmanzano_dtk | 5:07720e3f99d2 | 316 | ep.write(eprom_AddressArray[EE_Address_BLE_RESET_T], ((uint16_t) 3600)); // BLE Autoreset Time |
fmanzano_dtk | 5:07720e3f99d2 | 317 | ep.write(eprom_AddressArray[EE_Address_FINGERPRINT_RE], ((uint16_t) false)); // Fingerprint Enable |
fmanzano_dtk | 5:07720e3f99d2 | 318 | |
fmanzano_dtk | 5:07720e3f99d2 | 319 | // LED |
fmanzano_dtk | 5:07720e3f99d2 | 320 | flashLED = 1; |
fmanzano_dtk | 5:07720e3f99d2 | 321 | wait_ms(3750); |
fmanzano_dtk | 5:07720e3f99d2 | 322 | flashLED = 0; |
fmanzano_dtk | 5:07720e3f99d2 | 323 | #ifdef DEBUG_FLASH_CPP |
fmanzano_dtk | 5:07720e3f99d2 | 324 | myPC_debug.printf("\r\n FLASH - Completado!"); |
fmanzano_dtk | 5:07720e3f99d2 | 325 | #endif |
fmanzano_dtk | 5:07720e3f99d2 | 326 | } |
fmanzano_dtk | 5:07720e3f99d2 | 327 | |
fmanzano_dtk | 5:07720e3f99d2 | 328 | void writeEE(int myAddress, int myValue) { |
fmanzano_dtk | 5:07720e3f99d2 | 329 | ep.write(((uint32_t) myAddress), ((uint16_t) myValue)); |
fmanzano_dtk | 5:07720e3f99d2 | 330 | } |