From 834ea7fcea251350ca2db9a43eb39177654ef7d1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 14 Aug 2018 01:04:11 -0500 Subject: [PATCH] Remove 'const' from PersistentStore::capacity --- Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_LPC1768/HAL.cpp | 12 ++++++------ .../src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp | 2 +- .../src/HAL/HAL_STM32F1/persistent_store_flash.cpp | 2 +- .../src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp | 2 +- .../src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp | 2 +- .../src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp | 2 +- .../HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/shared/persistent_store_api.h | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp index 6efdc6e3e..1593b1829 100644 --- a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp @@ -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__ diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp index 3af0b0aa8..5fbb7b2dc 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp @@ -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 diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index 9bb43c2b2..aec9b4ce7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -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)); } }; diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp index f221f1b0b..730e9a582 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp @@ -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 diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp index cb91f12bf..ad29a1be4 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp @@ -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__ diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp index f25799d31..349abba24 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -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 diff --git a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp index 4a0917744..194cd21bc 100644 --- a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp @@ -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 diff --git a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp index c9a409ad1..bd08ad7f0 100644 --- a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp @@ -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 diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp index 7fc9fc6f7..46e88e04a 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp @@ -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__ diff --git a/Marlin/src/HAL/shared/persistent_store_api.h b/Marlin/src/HAL/shared/persistent_store_api.h index 278e49a8a..007a8ed73 100644 --- a/Marlin/src/HAL/shared/persistent_store_api.h +++ b/Marlin/src/HAL/shared/persistent_store_api.h @@ -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;