Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed trimStoredReadings... from conditional in two places #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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