![](/media/cache/group/icon1_qbDJ87a.png.50x50_q85.png)
高高度CanSat Space SWANの投下時に使用したプログラム.(IZU2019)
Dependencies: Nichrome_lib mbed ads1115_test BNO055_lib ADXL375_i2c ES920LR CCS811_lib SDFileSystem BME280_lib INA226_lib EEPROM_lib GPS_interrupt
Diff: main.cpp
- Revision:
- 4:b878dce9c247
- Parent:
- 3:4571111a5996
- Child:
- 5:b71a554ab4c4
--- a/main.cpp Wed Feb 20 17:31:45 2019 +0000 +++ b/main.cpp Fri Feb 22 12:21:23 2019 +0000 @@ -132,6 +132,8 @@ bool save_fast = false; int save_c = 0; +int eeprom_ptr; + int time_read, time_reset = 0; int time_min, time_sec, time_ms; @@ -545,11 +547,11 @@ if(!es920_using){ es920 << HEADER_DATA; - es920 << (short)time_reset; - es920 << (short)(time_read / 1000); + es920 << (unsigned short)time_reset; + es920 << (unsigned short)(time_read / 1000); - es920 << (short)flight_time_reset; - es920 << (short)(flight_time_read / 1000); + es920 << (unsigned short)flight_time_reset; + es920 << (unsigned short)(flight_time_read / 1000); es920 << CanSat_phase; @@ -572,15 +574,15 @@ es920 << (unsigned short)(gps_alt / ES920_MAX_1500); es920 << (unsigned short)(gps_knot / ES920_MAX_200); es920 << (unsigned short)(gps_deg / ES920_MAX_500); - es920 << (short)gps_sat; + es920 << (unsigned short)gps_sat; es920 << (unsigned short)(ina_v / ES920_MAX_20); es920 << (unsigned short)(ina_i / ES920_MAX_20); es920 << (unsigned short)(pres / ES920_MAX_1500); es920 << (unsigned short)(temp / ES920_MAX_100); - es920 << (unsigned short)(alt / ES920_MAX_500); - es920 << (unsigned short)(speed / ES920_MAX_50); + es920 << (short)(alt / ES920_MAX_500); + es920 << (short)(speed / ES920_MAX_50); es920 << (short)(euler[0] / ES920_MAX_5); es920 << (short)(euler[1] / ES920_MAX_5); @@ -774,7 +776,60 @@ fprintf(fp, "%d,%d,", CO2, TVOCs); fprintf(fp, "%f\r\n", bottle_pres); - //EEPROM + /////////////////////////////////////////////////////////////////////EEPROM + EEPROM.chargeBuff((unsigned short)time_reset); + EEPROM.chargeBuff((int)time_read); + EEPROM.chargeBuff((unsigned short)flight_time_reset); + EEPROM.chargeBuff((int)flight_time_read); + EEPROM.chargeBuff((char)CanSat_phase); + char status = 0x00; + if(controll_yn) status |= 0x01; + if(flight_pin) status |= 0x02; + if(Valve1.status) status |= 0x04; + if(Valve2.status) status |= 0x08; + if(Valve3.status) status |= 0x10; + if(Valve4.status) status |= 0x20; + if(Buzzer.status) status |= 0x40; + EEPROM.chargeBuff((char)status); + EEPROM.chargeBuff((char)es920_uplink_command); + EEPROM.chargeBuff((char)gps_yn); + EEPROM.chargeBuff((float)gps_lat); + EEPROM.chargeBuff((float)gps_lon); + EEPROM.chargeBuff((float)gps_alt); + EEPROM.chargeBuff((float)gps_knot); + EEPROM.chargeBuff((float)gps_deg); + EEPROM.chargeBuff((unsigned short)gps_sat); + EEPROM.chargeBuff((float)adxl_acc[0]); + EEPROM.chargeBuff((float)adxl_acc[1]); + EEPROM.chargeBuff((float)adxl_acc[2]); + EEPROM.chargeBuff((float)ina_v); + EEPROM.chargeBuff((float)ina_i); + EEPROM.chargeBuff((float)pres); + EEPROM.chargeBuff((float)temp); + EEPROM.chargeBuff((float)hum); + EEPROM.chargeBuff((float)alt); + EEPROM.chargeBuff((float)speed); + EEPROM.chargeBuff((short)(amg[0] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[1] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[2] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[3] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[4] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[5] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[6] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[7] / ES920_MAX_50)); + EEPROM.chargeBuff((short)(amg[8] / ES920_MAX_50)); + EEPROM.chargeBuff((float)quart[0]); + EEPROM.chargeBuff((float)quart[1]); + EEPROM.chargeBuff((float)quart[2]); + EEPROM.chargeBuff((float)quart[3]); + EEPROM.chargeBuff((short)(euler[0] / ES920_MAX_500)); + EEPROM.chargeBuff((short)(euler[1] / ES920_MAX_500)); + EEPROM.chargeBuff((short)(euler[2] / ES920_MAX_500)); + EEPROM.chargeBuff((unsigned short)CO2); + EEPROM.chargeBuff((unsigned short)TVOCs); + EEPROM.chargeBuff((float)bottle_pres); + EEPROM.writeBuff(); + eeprom_ptr = EEPROM.setNextPage(); }