Remove 'const' from PersistentStore::capacity

This commit is contained in:
Scott Lahteine 2018-08-14 01:04:11 -05:00
parent c64199941e
commit 834ea7fcea
10 changed files with 15 additions and 15 deletions

View file

@ -62,7 +62,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; // always assume success for AVR's return false; // always assume success for AVR's
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // __AVR__ #endif // __AVR__

View file

@ -71,7 +71,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM

View file

@ -125,13 +125,13 @@ bool HAL_adc_finished(void) {
// possible config options if something similar is extended to more platforms. // possible config options if something similar is extended to more platforms.
#define ADC_USE_MEDIAN_FILTER // Filter out erroneous readings #define ADC_USE_MEDIAN_FILTER // Filter out erroneous readings
#define ADC_MEDIAN_FILTER_SIZE (23) // Higher values increase step delay (phase shift), #define ADC_MEDIAN_FILTER_SIZE 23 // Higher values increase step delay (phase shift),
// (ADC_MEDIAN_FILTER_SIZE + 1) / 2 sample step delay (12 samples @ 500Hz: 24ms phase shift) // (ADC_MEDIAN_FILTER_SIZE + 1) / 2 sample step delay (12 samples @ 500Hz: 24ms phase shift)
// Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16 // Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16
// 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels // 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels
#define ADC_USE_LOWPASS_FILTER // Filter out high frequency noise #define ADC_USE_LOWPASS_FILTER // Filter out high frequency noise
#define ADC_LOWPASS_K_VALUE (6) // Higher values increase rise time #define ADC_LOWPASS_K_VALUE 6 // Higher values increase rise time
// Rise time sample delays for 100% signal convergence on full range step // Rise time sample delays for 100% signal convergence on full range step
// (1 : 13, 2 : 32, 3 : 67, 4 : 139, 5 : 281, 6 : 565, 7 : 1135, 8 : 2273) // (1 : 13, 2 : 32, 3 : 67, 4 : 139, 5 : 281, 6 : 565, 7 : 1135, 8 : 2273)
// K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step // K = 6, 565 samples, 500Hz sample rate, 1.13s convergence on full range step
@ -162,7 +162,7 @@ struct MedianFilter {
datum = STOPPER + 1; // No stoppers allowed. datum = STOPPER + 1; // No stoppers allowed.
} }
if ( (++datpoint - buffer) >= ADC_MEDIAN_FILTER_SIZE) { if ( (++datpoint - buffer) >= (ADC_MEDIAN_FILTER_SIZE)) {
datpoint = buffer; // Increment and wrap data in pointer. datpoint = buffer; // Increment and wrap data in pointer.
} }
@ -224,9 +224,9 @@ struct MedianFilter {
struct LowpassFilter { struct LowpassFilter {
uint32_t data_delay = 0; uint32_t data_delay = 0;
uint16_t update(uint16_t value) { uint16_t update(const uint16_t value) {
data_delay = data_delay - (data_delay >> ADC_LOWPASS_K_VALUE) + value; data_delay -= (data_delay >> (ADC_LOWPASS_K_VALUE)) - value;
return (uint16_t)(data_delay >> ADC_LOWPASS_K_VALUE); return (uint16_t)(data_delay >> (ADC_LOWPASS_K_VALUE));
} }
}; };

View file

@ -175,7 +175,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return bytes_read != size; // return true for any error return bytes_read != size; // return true for any error
} }
const size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM
#endif // !FLASH_EEPROM #endif // !FLASH_EEPROM
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS

View file

@ -101,7 +101,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false; return false;
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS && EEPROM FLASH #endif // EEPROM_SETTINGS && EEPROM FLASH
#endif // __STM32F1__ #endif // __STM32F1__

View file

@ -79,7 +79,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
return false; return false;
} }
const size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; } size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS

View file

@ -64,7 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // STM32F4 || STM32F4xx #endif // STM32F4 || STM32F4xx

View file

@ -64,7 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // STM32F7 #endif // STM32F7

View file

@ -65,7 +65,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
return false; return false;
} }
const size_t PersistentStore::capacity() { return E2END + 1; } size_t PersistentStore::capacity() { return E2END + 1; }
#endif // EEPROM_SETTINGS #endif // EEPROM_SETTINGS
#endif // __MK64FX512__ || __MK66FX1M0__ #endif // __MK64FX512__ || __MK66FX1M0__

View file

@ -31,7 +31,7 @@ public:
static bool access_finish(); static bool access_finish();
static bool write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc); static bool write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc);
static bool read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing=true); static bool read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing=true);
static const size_t capacity(); static size_t capacity();
static inline bool write_data(const int pos, uint8_t* value, const size_t size) { static inline bool write_data(const int pos, uint8_t* value, const size_t size) {
int data_pos = pos; int data_pos = pos;