Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MeasurementHistory.h
- Revision:
- 12:856286ad4cdc
- Parent:
- 11:dbc310addbf6
- Child:
- 16:eed9a9ba319c
diff -r dbc310addbf6 -r 856286ad4cdc MeasurementHistory.h --- a/MeasurementHistory.h Tue Mar 19 20:48:48 2019 +0000 +++ b/MeasurementHistory.h Mon Mar 25 14:54:43 2019 +0000 @@ -7,21 +7,25 @@ // constructor MeasurementHistory(); - void addMeasurement(uint16_t temp, uint16_t pressure, uint16_t humidity, float time); + // Add some new values to the history + void addMeasurement(float temp, float pressure, float humidity, uint32_t time); private: struct Data { - uint16_t m_temp; - uint16_t m_pressure; - uint16_t m_humidity; - float m_time; + uint16_t temp; + uint16_t pressure; + uint16_t humidity; + uint32_t time; + // Size: 80 bits, 10 Bytes }; + + // Counting the array's dimension according to max size + static const int DEFAULT_SIZE = 2048; + static const int ARRAY_SIZE = DEFAULT_SIZE/sizeof(Data); + // data members - static const int DEFAULT_SIZE = 1000; - static const int ARRAY_SIZE = DEFAULT_SIZE / sizeof(DEFAULT_SIZE); - - Data m_measures[/*ARRAY_SIZE*/3]; + Data m_measures[ARRAY_SIZE]; int m_index; };