Browse Source

Hide freeMemory et.al. warnings

pull/1/head
Scott Lahteine 5 years ago
parent
commit
4200f9ed62
  1. 6
      Marlin/src/HAL/HAL_STM32F1/HAL.h
  2. 4
      Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp

6
Marlin/src/HAL/HAL_STM32F1/HAL.h

@ -180,11 +180,17 @@ static int freeMemory() {
return top; return top;
} }
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int freeMemory() { static int freeMemory() {
volatile char top; volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
#pragma GCC diagnostic pop
// //
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
// //

4
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp

@ -62,7 +62,7 @@ bool PersistentStore::access_finish() {
} }
bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
for (int i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
HAL_STM32F1_eeprom_content[pos + i] = value[i]; HAL_STM32F1_eeprom_content[pos + i] = value[i];
crc16(crc, value, size); crc16(crc, value, size);
pos += size; pos += size;
@ -70,7 +70,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si
} }
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
for (int i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
uint8_t c = HAL_STM32F1_eeprom_content[pos + i]; uint8_t c = HAL_STM32F1_eeprom_content[pos + i];
if (writing) value[i] = c; if (writing) value[i] = c;
crc16(crc, &c, 1); crc16(crc, &c, 1);

Loading…
Cancel
Save