-
Notifications
You must be signed in to change notification settings - Fork 50
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
Review PR: Add "Offline" SDLogger Mode #676
base: main
Are you sure you want to change the base?
Conversation
…working fully yet
…rsnapper_V2 class
Use latest build artifacts
New checkin model class added along with functions within .cpp to exec. it
…ne devices too and eventual cellular
…pplicable to properly indicate its a stub class, add pico to ini
"top": 9.2, | ||
"left": 74, | ||
"rotate": 270, | ||
"attrs": { "color": "green" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using bounce:0 here too? (Like ../diagram.json)
@@ -24,12 +24,12 @@ void setup() { | |||
wipper.provision(); | |||
|
|||
Serial.begin(115200); | |||
//while (!Serial) delay(10); | |||
while (!Serial) delay(10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be commented out again
|
||
wipper.connect(); | ||
|
||
} | ||
|
||
void loop() { | ||
wipper.run(); | ||
//wipper.run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be re-enabled
import json | ||
|
||
# load json file from provided path | ||
with open(sys.argv[1], 'r') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to trap errors here (like no args and missing file), but looks like it's only for our usage anyway
C:\dev\arduino\Adafruit_Wippersnapper_Arduino [review-mode-sdlogger ≡ +1 ~1 -0 !]> python .\generate_json_checksum.py
Traceback (most recent call last):
File "C:\dev\arduino\Adafruit_Wippersnapper_Arduino\generate_json_checksum.py", line 6, in <module>
with open(sys.argv[1], 'r') as f:
~~~~~~~~^^^
IndexError: list index out of range
C:\dev\arduino\Adafruit_Wippersnapper_Arduino [review-mode-sdlogger ≡ +1 ~1 -0 !]> python .\generate_json_checksum.py a.json
Traceback (most recent call last):
File "C:\dev\arduino\Adafruit_Wippersnapper_Arduino\generate_json_checksum.py", line 6, in <module>
with open(sys.argv[1], 'r') as f:
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'a.json'
@@ -14,12 +14,13 @@ default_envs = adafruit_feather_esp32s3_tft, adafruit_magtag29_esp32s2, adafruit | |||
[env] | |||
framework = arduino | |||
monitor_speed = 115200 | |||
extra_scripts = upload_no_build.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not intended to be here I believe
Import("env") | ||
env.AddCustomTarget( | ||
"uploadnobuild", | ||
None, | ||
'pio run -e %s -t nobuild -t upload' % | ||
env["PIOENV"], | ||
title="Uploads without building" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does seem useful, but probably not in this PR / needs fixing up (doesn't appear to function)
}, | ||
{ | ||
"componentAPI": "ds18x20", | ||
"name": "DS18B20: Temperature Sensor (°F)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This degree symbol is \u encoded in another config (src/config.json), not sure it matters, but was curious how the two ended up differing/ Looks like export includes the degree symbol, so probably the checksum calculation script is doing it.
Also the sensor component appears to be including two metrics, so should be named differently, and presumably major rework for the front end / rails to accommodate (but totally in line with our talk of one poll period per sensor instead of subcomponent).
WS_DEBUG_PRINTLN("Published AnalogIOEvent message to broker!") | ||
} else { | ||
|
||
// TODO: Log out this data by calling a logging function in sdcard class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming we're not doing general logging and only datapoints are logged to SD, is that correct?
uint8_t workbuf_v2[4096]; | ||
|
||
// make filesystem | ||
FRESULT r = f_mkfs("", FM_FAT | FM_SFD, 0, workbuf_v2, sizeof(workbuf_v2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This result could be checked too
} | ||
|
||
// Write contents to the formatted filesystem | ||
if (!writeFSContents()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be called unless !is_fs_formatted so we avoid writing to the file system unnecessarily. Alternatively the comments throughout the method mention it being a fresh file system which won't be the case most of the time with the current code.
Alternatively the brownout PR can resolve that issue of unnecessarily replacing bootout.txt
each boot and we can fix this up later.
#define UNKNOWN_VALUE "unknown" ///< Default unknown JSON field value | ||
#define MAX_SZ_LOG_FILE (512 * 1024 * 1024) ///< Maximum log file size, in Bytes | ||
#define MAX_LEN_CFG_JSON \ | ||
4096 ///< Maximum length of the configuration JSON file, in Bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably need to be bigger / doubled, the current offline-config is 1.5k with 4 components
This pull request is not meant to be merged in. It is a review-only pull request for specific regions of code.
Codebase regions for review
ws_sdcard
- for interfacing with a micro SD Card breakout.parseConfigFile
functions and looksBuildJSONDoc
andLogJSONDoc
API interfaces are present for each type of componentws_sdcard
and mode-switching (determining whether the device is online or offline) withinWipperSnapper_V2
class in two functions -provision()
andconnect()
FS_V2
andLittleFS_V2
network_interfaces/
toadapters/
to allow for a WipperSnapper device without a network interface (offline/
).adapters/offline/ws_offline_pico
to support a Raspberry Pi in offline mode.Workflow enhancements for review:
run-tests.yml
, to automate testing using Wokwi.