Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Sensor_0.0.2_Prod/sensor.device.nut
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,9 @@ function saveReadingToNV(reading){
local nvSize = estimateSize(nv);
local saveReadingTable = {}
saveReadingTable = clone(reading);
local enoughMemoryForReading = trimStoredNVReadingsEvenly(readingSize);
//trim the nv table if there isn't enough room:
if(trimStoredNVReadingsEvenly(readingSize)){
if(enoughMemoryForReading){
nv.data.append(saveReadingTable);
} else {
//can't log this in any way dealing the the NV table safely
Expand Down Expand Up @@ -1433,7 +1434,8 @@ function pushError(errorTable){
local numberStoredErrors = nv.storedErrors.len();
//less than maximum number stored are in the nv table:
//trim the nv readings if there isn't enough room since errors are more important:
if(trimStoredNVReadingsEvenly(estimateSize(errorTable))){
local enoughMemoryForError = trimStoredNVReadingsEvenly(estimateSize(errorTable));
if(enoughMemoryForError){
if(numberStoredErrors < STORED_ERRORS_MAX){
nv.storedErrors.append(errorTable);
} else {
Expand Down