Fix compilation warnings

This commit is contained in:
Starbeamrainbowlabs 2019-06-27 15:58:01 +01:00
parent 18342c55fc
commit bbf12da323
3 changed files with 10 additions and 6 deletions

View file

@ -1,7 +1,6 @@
#include "settings.h"
#include <Arduino.h>
#include <TinyGPS++.h>
#include <SD.h>
#include <MemoryFree.h>
#include "random.h"
@ -45,7 +44,7 @@ void setup() {
store_debug(gps_data.time, 19);
#endif
Serial.println(freeMemory(), DEC);
store_close();
store_end();
Serial.println(freeMemory(), DEC);
// ------------------------------------------------------------------------

View file

@ -10,7 +10,10 @@ SdFat* card = nullptr;
void store_init() {
card = new SdFat();
card->begin(PIN_SPI_CS_SD);
if(!card->begin(PIN_SPI_CS_SD)) {
Serial.println("Error: MicroSD card init failed");
while(true) delay(100);
}
}
void store_reading(uint32_t id, GPSLocation location) {
@ -38,6 +41,8 @@ void store_debug(char* buffer, int size) {
}
void store_end() {
card.end();
// Apparently we'ree fine so long as we don't have any open file handles - there's no end() method on the SdFat class
// card->end();
delete card;
card = nullptr;
}

View file

@ -1,7 +1,7 @@
#pragma once
#include <SPI.h>
#include <SD.h>
#include <SdFat.h>
#include <TinyGPS++.h>
@ -11,4 +11,4 @@ void store_reading(uint32_t id, GPSLocation location);
void store_debug(char* buffer, int size);
void store_close();
void store_end();