Version FC
Dependencies: DmTftLibrary eeprom SX1280Lib filesystem mbed
Fork of MSNV2-Terminal_V1-5 by
Diff: ExtMemory.cpp
- Revision:
- 41:5a436163dddf
- Parent:
- 36:14a8da4108d5
--- a/ExtMemory.cpp Tue Oct 16 07:29:51 2018 +0000 +++ b/ExtMemory.cpp Mon Oct 22 09:37:50 2018 +0000 @@ -20,6 +20,8 @@ // ===================================== Methods of class void ExtMemory::read (DataBase* dataBase) { + + printf ( "*** EXTM *** Read start \n\r"); // read eeprom and initialize database //(Example) @@ -29,7 +31,7 @@ int32_t pos=0; ServiceDefinition sd,prev_sd; Header hd; - EEPROM ep(I2C_SDA, I2C_SCL, EEPROM_ADDR, EEPROM::T24C04); + //EEPROM ep (I2C_SDA, I2C_SCL, EEPROM_ADDR, EEPROM::T24C04); // FC to compile DEBUG( "*** EXTMEM Reading external memory ***\n"); @@ -38,8 +40,8 @@ #endif // ---- read header block - ep.read(pos, (void *) &hd, sizeof(hd)); - if (ep.getError() != 0) error(ep.getErrorMessage()); + //ep.read(pos, (void *) &hd, sizeof(hd)); + //if (ep.getError() != 0) error(ep.getErrorMessage()); pos += sizeof(hd); DEBUG("*** [reading header] services:%d mode:0x%02x payloadID:0x%04x ***\n", hd.nb_of_services, hd.operating_mode, hd.payload_id); @@ -50,7 +52,10 @@ std::vector<Service*> services = std::vector<Service*>(); Component* component; std::string name[6] = {"HTS221","LPS22HB","LSM303D","LSM6DSL","BME280","DS18B20"}; // debug purpose + + /* FC pour débloquer l'execution while(servicesNbr<servicesTotal){ + while(ep.read(pos, (void *) &sd, sizeof(sd)),(servicesNbr<servicesTotal)){ pos += sizeof(sd); if (ep.getError() != 0) { error(ep.getErrorMessage()); continue;} @@ -85,6 +90,7 @@ services.clear(); DEBUG("\n"); } + */ Payload * payload = new Payload((misnet::Payload::PAYLOAD_ID) hd.payload_id, components, hd.payload_base_period); dataBase->setPayload(payload); @@ -247,7 +253,12 @@ // // Enregistrement de la payload dans la database // // --------------------------------------------- // dataBase->setPayload(payload); + + printf ( "*** EXTM *** Read done \n\r"); + } + +/* void ExtMemory::populate (void) { int32_t pos=0; @@ -330,4 +341,5 @@ pos += sizeof(sd); printf("service5 ID:0x%02x type:0x%02x code:0x%04x\n", sd_r.component_id, sd_r.service_type, sd_r.mistnet_code); -} \ No newline at end of file +} +*/ \ No newline at end of file