Remove 'const' from PersistentStore::capacity
This commit is contained in:
parent
c64199941e
commit
834ea7fcea
@ -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
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // __AVR__
|
||||
|
@ -71,7 +71,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // ARDUINO_ARCH_SAM
|
||||
|
@ -125,13 +125,13 @@ bool HAL_adc_finished(void) {
|
||||
|
||||
// possible config options if something similar is extended to more platforms.
|
||||
#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)
|
||||
// Memory usage per ADC channel (bytes): (6 * ADC_MEDIAN_FILTER_SIZE) + 16
|
||||
// 8 * ((6 * 23) + 16 ) = 1232 Bytes for 8 channels
|
||||
|
||||
#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
|
||||
// (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
|
||||
@ -162,7 +162,7 @@ struct MedianFilter {
|
||||
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.
|
||||
}
|
||||
|
||||
@ -224,9 +224,9 @@ struct MedianFilter {
|
||||
|
||||
struct LowpassFilter {
|
||||
uint32_t data_delay = 0;
|
||||
uint16_t update(uint16_t value) {
|
||||
data_delay = data_delay - (data_delay >> ADC_LOWPASS_K_VALUE) + value;
|
||||
return (uint16_t)(data_delay >> ADC_LOWPASS_K_VALUE);
|
||||
uint16_t update(const uint16_t value) {
|
||||
data_delay -= (data_delay >> (ADC_LOWPASS_K_VALUE)) - value;
|
||||
return (uint16_t)(data_delay >> (ADC_LOWPASS_K_VALUE));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
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 // EEPROM_SETTINGS
|
||||
|
@ -101,7 +101,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS && EEPROM FLASH
|
||||
#endif // __STM32F1__
|
||||
|
@ -79,7 +79,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
|
||||
size_t PersistentStore::capacity() { return HAL_STM32F1_EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // STM32F4 || STM32F4xx
|
||||
|
@ -64,7 +64,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // STM32F7
|
||||
|
@ -65,7 +65,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
static bool access_finish();
|
||||
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 const size_t capacity();
|
||||
static size_t capacity();
|
||||
|
||||
static inline bool write_data(const int pos, uint8_t* value, const size_t size) {
|
||||
int data_pos = pos;
|
||||
|
Loading…
Reference in New Issue
Block a user