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

Cellular and Data storage #24

Merged
merged 92 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
112698c
Import SpiffsParticleRK and data upload
emilybthorpe Aug 1, 2023
a0fb493
Fix particle connect
emilybthorpe Aug 1, 2023
aad1114
cellular work
emilybthorpe Aug 4, 2023
18a1137
Merge branch 'chargetask' into cellular
emilybthorpe Aug 4, 2023
21ad015
Fix imports
emilybthorpe Aug 4, 2023
5d3579f
Basic cellular working
emilybthorpe Aug 4, 2023
16c89ad
Porting ensembleTypes from v2
emilybthorpe Aug 5, 2023
2d367ac
Clean up ensemble header with comments
emilybthorpe Aug 5, 2023
253136e
more cellular work
emilybthorpe Aug 5, 2023
8106ccb
port over deploy and prereqs from fw2
emilybthorpe Aug 7, 2023
7135d91
port over code for basic data upload/encode
emilybthorpe Aug 7, 2023
12130f5
cellular debugging
emilybthorpe Aug 7, 2023
bfef833
Testing littlefs
emilybthorpe Aug 7, 2023
ae3ce50
implement tests for hasdata and createFile
emilybthorpe Aug 7, 2023
0530b4b
implement getNumFiles
emilybthorpe Aug 7, 2023
1933d3c
remove spiff-fs and replace with particle little-fs
emilybthorpe Aug 8, 2023
f41ae8e
more cellular work
emilybthorpe Aug 8, 2023
de0e6e2
Deploy debugging
emilybthorpe Aug 9, 2023
f366142
Fix recorder attempting to get data from empty file
emilybthorpe Aug 10, 2023
09bebee
Add doxygen
emilybthorpe Aug 10, 2023
b646a8e
Merge branch 'main' into cellular
emilybthorpe Aug 10, 2023
ac07ddd
Add doxygen for system upload command
emilybthorpe Aug 10, 2023
4f472f4
Merge branch 'cellular' of https://github.com/UCSD-E4E/smartfin-fw3 i…
emilybthorpe Aug 10, 2023
7c48b7e
Formatting
emilybthorpe Aug 10, 2023
03df172
remove testing publish
emilybthorpe Aug 10, 2023
c882ca2
Fix stat not initalizing and therefore causing undefined behavior fix…
emilybthorpe Aug 11, 2023
c06d365
Fix compliation warnings
emilybthorpe Aug 11, 2023
caf98d5
Merge branch 'main' into cellular
emilybthorpe Aug 21, 2023
d358311
Merge branch 'main' into cellular
emilybthorpe Aug 28, 2023
b91a234
feature: get data from sensor instead of fake data
emilybthorpe Aug 28, 2023
7fd2a80
Merge branch 'main' into cellular
emilybthorpe Aug 29, 2023
5180cd6
feature: integrate temp sensor to data collection
emilybthorpe Aug 29, 2023
ee29c9e
Merge branch 'main' into cellular
Sep 11, 2023
770cb2b
fix: Removes SpiffsParticleRK dependency
Sep 11, 2023
563e2e3
fix: Fixes newlines
Sep 11, 2023
409c7c4
fix! switches to 32 bit param, adds opendir fail
Sep 11, 2023
82ca64c
feat!: Adds fileCLI
Sep 11, 2023
6154c5b
fix: Reduces flog entries to 128
Sep 12, 2023
b74b46d
fix: Fixes tooling paths and switches to c++11
Sep 12, 2023
bd0ae1e
fix: Includes
Sep 12, 2023
3c80ff7
chore: Adds ruler
Sep 12, 2023
32349fe
fix: Adds debug point flog
Sep 12, 2023
66475c7
feat: Adds ls functionality
Sep 12, 2023
621797d
style: Fixes long line
Sep 12, 2023
3422dcb
fix: Adds chgdir
Sep 12, 2023
d35ff05
feat: Adds cd and pwd
Sep 12, 2023
08ad4c4
feat: Adds rm, fixes buildpath
Sep 12, 2023
6344465
feat: Adds hexdump
Sep 12, 2023
263381a
feat: Added file publish dump
Sep 12, 2023
c2cfcd5
feat: Adds helptext
Sep 12, 2023
be37dac
fix: Updates helptext
Sep 12, 2023
4cab8a3
style: Formatting
Sep 12, 2023
c41fe78
fix: Updates base85 to latest
Sep 12, 2023
eccb68f
docs: Updates library register
Sep 12, 2023
825e778
fix: Rolling back base85
Sep 12, 2023
afa0351
docs: Adds Recorder class
Sep 21, 2023
1f58ab3
feat: Switches to consolidated menu system
Sep 22, 2023
56c243a
fix: Fixes sleep CLI
Sep 22, 2023
f23356f
fix: Fixes upload CLI
Sep 22, 2023
cb0da06
fix: Fixes includes
Sep 22, 2023
47a6bd8
fix: Updates hexdump
Sep 23, 2023
cd1effd
feat: Functional session
Sep 27, 2023
86a4b45
fix: Updates flog
Sep 27, 2023
4d6f328
fix: Fixes data location initialization
Sep 27, 2023
f641578
feat: Adds mkdir
Sep 27, 2023
24cafec
fix: Added FLOG include
Sep 27, 2023
a9eb5e9
feat: Adds basic recorder functionality and test
Sep 29, 2023
815c6a1
fix: Fixes current_dir level
Sep 29, 2023
e3cc6a5
fix: Removes setName
Sep 29, 2023
1cdb02b
feat: Adds setSessionTime
Sep 29, 2023
b773e64
docs: Fixes environment
Oct 13, 2023
cf7b70e
feat: Adds fsync to write
Oct 13, 2023
9198bb1
docs: Adds more docs
Oct 13, 2023
98de874
feat: Adds additional fs flog entries
Oct 13, 2023
a2f5a6d
chore: Removes old debug flog
Oct 13, 2023
6a574c0
feat: Adds packetizing
Oct 13, 2023
a296ff0
feat: Adds pop last packet debug
Oct 13, 2023
654abd5
fix: Pops on empty session
Oct 13, 2023
dc66939
feat: Adds error handling to creation
Oct 13, 2023
63b10dd
fix: Adds protection against double open
Oct 13, 2023
ab59ef8
feat: Completes recorder
Oct 13, 2023
5a5f745
docs: Updates service diagram
Oct 17, 2023
c7cac65
chore: Ignores plantuml output
Oct 17, 2023
3502cc2
docs: Updated diagram
Oct 19, 2023
45b392e
docs: Ignores firmware diagram output
Oct 19, 2023
7339458
fix: Enabled cloud connectivity commands
Oct 19, 2023
8720114
fix: Cleaned up flog entries
Oct 19, 2023
8a3bd5e
docs: Updated application progress
Oct 19, 2023
2adc537
feat: Adds firmware hashes
Oct 19, 2023
674701e
feat: Adds DeviceOS version display
Oct 19, 2023
d2b7868
feat: Adds publish_blob
Feb 9, 2024
4774141
Merge branch 'main' into cellular
ntlhui Feb 9, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,5 @@ smartfin-fw3.cpp
target/
*.bin
nul
out/docs/application/Service Diagram.png
out/docs/fw_flow/Firmware Flowchart.png
5 changes: 3 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"windowsSdkVersion": "10.0.22000.0",
"compilerPath": "~\\.particle\\toolchains\\gcc-arm\\10.2.1\\bin\\arm-none-eabi-gcc.exe",
"intelliSenseMode": "windows-gcc-arm",
"cStandard": "c17",
"cppStandard": "c++17",
"cStandard": "c11",
"cppStandard": "c++11",
"configurationProvider": "particle.particle-vscode-core",
"mergeConfigurations": true,
"browse": {
Expand All @@ -26,6 +26,7 @@
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\hal\\inc",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\hal\\shared",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\hal\\src\\gcc",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\hal\\src\\nRF52840\\posix",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\services\\inc",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\system",
"~\\.particle\\toolchains\\deviceOS\\5.3.0\\wiring",
Expand Down
17 changes: 13 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,20 @@
"particle.targetDevice": "",
"cmake.configureOnOpen": false,
"C_Cpp.codeAnalysis.clangTidy.enabled": false,
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.intelliSenseMode": "windows-gcc-arm",
"C_Cpp.intelliSenseEngine": "Tag Parser",
"C_Cpp.default.cppStandard": "c++11",
"C_Cpp.default.cStandard": "c11",
"C_Cpp.doxygen.generatedStyle": "/**",
"C_Cpp.autoAddFileAssociations": false,
"editor.rulers": [
80
],
"particle.enableVerboseLocalCompilerLogging": true,
"C_Cpp.vcFormat.space.pointerReferenceAlignment": "left",
"C_Cpp.formatting": "vcFormat",
"C_Cpp.vcFormat.newLine.scopeBracesOnSeparateLines": true,
"C_Cpp.vcFormat.newLine.beforeOpenBrace.type": "newLine",
"C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "newLine",
"C_Cpp.vcFormat.indent.preserveWithinParentheses": true,
"C_Cpp.vcFormat.indent.preprocessor": "oneLeft",

}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ gps-nmea-parser | 1.2.0 | Apache 2.0 | https://github.com/particle-iot/gps-nme
tracker edge | v18 | Apache 2.0 | https://github.com/particle-iot/tracker-edge | lib/tracker-edge
SparkFun ICM | 1.2.0 | MIT | https://github.com/UCSD-E4E/SparkFun_ICM-20948_ParticleLibrary | lib/SparkFun_ICM-20948_ParticleLibrary
Max 31725 | 2019 | Apache 2.0 | https://os.mbed.com/teams/MaximIntegrated/code/MAX31725_Accurate_Temperature_Sensor//file/b4fdbbe79036/max31725.h/ | temperature/
urlsafe-b64 | 022c4cc | MIT | https://github.com/Akagi201/urlsafe-b64 | src/cellular/encoding
base85 | 9c52d27 | MIT | https://github.com/rafagafe/base85 | src/cellular/encoding



Expand Down
112 changes: 68 additions & 44 deletions docs/application.puml
Original file line number Diff line number Diff line change
@@ -1,66 +1,90 @@
' Green for modules that are complete
' Yellow for modules that are WIP
' Red for modules that are not implemented
@startuml Service Diagram
top to bottom direction

skinparam nodesep 50
skinparam ranksep 150

package "Device OS" {
[Cellular] as cellular
[I2C] as i2c
[Serial] as serial
[Filesystem] as fs
[SPI] as spi
[NVRAM] as nvram
[Cellular] as cellular #Yellow
[I2C] as i2c #Green
[Serial] as serial #Green
[Filesystem] as fs #Green
[SPI] as spi #Green
[GPIO] as gpio #Green
[EEPROM] as eeprom #Green
}


package "Application" {
[CLI] as cli
[Ride] as ride
[Charge Task] as charge_task
[Sleep Task] as sleep_task
[Location Service] as loc_service
[CLI] as cli #Green
[Ride] as ride #Red
[Charge Task] as charge_task #Green
[Sleep Task] as sleep_task #Green
[Data Upload] as upload #Red
}

package "Board Support Package" {
[Temp Sensor] as temp_sensor
[Water Sensor] as water_sensor
[GPS] as gps
[LED] as led
[ICM] as icm
[Temp Sensor] as temp_sensor #Green
[Water Sensor] as water_sensor #Green
[Location Service] as loc_service #Green
[GPS] as gps #Green
[LED] as led #Green
[ICM] as icm #Green
}
[ConIO] as conio
[Recorder] as recorder
[FLOG] as flog

ride --> temp_sensor
ride --> gps
ride --> icm
package "Application Support Package" {
[ConIO] as conio #Green
[Recorder] as recorder #Green
[FLOG] as flog #Green
[NVRAM] as nvram #Green
}

ride <-- temp_sensor
ride <-- gps
ride <-- icm
ride --> recorder
ride --> flog
ride --> water_sensor
loc_service --> gps
' ride -r-> flog
ride <-- water_sensor
loc_service -r-> gps
charge_task --> led
charge_task --> flog
' charge_task -r-> flog
sleep_task --> led
sleep_task --> nvram
sleep_task --> flog
' sleep_task -r-> flog

cli --> gps
cli --> temp_sensor
cli --> conio
cli --> flog
cli --> icm
cli --> nvram
cli --> water_sensor
cli <-- gps
cli <-- temp_sensor
cli <--> conio
' cli -r-> flog
cli <-- icm
cli <--> nvram
cli <-- water_sensor

gps --> spi
icm --> i2c
water_sensor --> i2c
temp_sensor --> i2c
conio --> serial
recorder --> fs
recorder --> cellular
recorder --> nvram
recorder --> flog
conio --> flog
gps --> flog
icm --> flog
water_sensor --> flog
temp_sensor --> flog
recorder <--> fs

water_sensor --> gpio
led --> gpio
ride --> led
nvram --> eeprom
eeprom -> fs
upload <-- recorder
upload --> cellular
upload <-- water_sensor
upload --> led
charge_task --> gpio
upload --> gpio
sleep_task <-- water_sensor
' recorder -u-> flog
' conio -u-> flog
' gps -u-> flog
' icm -u-> flog
' water_sensor -u-> flog
' temp_sensor -u-> flog
@enduml
13 changes: 13 additions & 0 deletions docs/arch.puml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ class SystemFlags_t{
bool hasCharger
bool inWater
}

class Recorder {
int init()
int hasData()
int getLastPacket(void*, size_t, char* size_t)
int popLastPacket(size_t)
void setSessionName(const char*)
int getNumFiles()
int openSession(const char* const)
int closeSession()
int putBytes(const void*, size_t)
int putData(T)
}
LocationService o-- pLocService
SystemDesc o-- SystemFlags_t
@enduml
116 changes: 62 additions & 54 deletions docs/fw_flow.puml
Original file line number Diff line number Diff line change
@@ -1,75 +1,83 @@
@startuml Firmware Flowchart
hide empty description

Sleep: D1 OFF
Sleep: DS1 Charging Status
Sleep: DS2 Water Detect Status
Sleep: Cell Modem OFF

Connect: D1 Solid Blue
Connect: DS1 Charging Status
Connect: DS2 Water Detect Status
Connect: Cell Modem ON
state DataUpload {
Connect: D1 Solid Blue
Connect: DS1 Charging Status
Connect: DS2 Water Detect Status
Connect: Cell Modem ON

Transmit: D1 Blink Blue
Transmit: DS1 Charging Status
Transmit: DS2 Water Detect Status
Transmit: Cell Modem ON
}

state Ride {
state "Deployed/No GPS" as deployed_nogps
deployed_nogps: D1 Solid White
deployed_nogps: DS1 Charging Status
deployed_nogps: DS2 Water Detect Status
deployed_nogps: Cell Modem OFF

state "Charged Complete" as charge_complete
charge_complete: D1 OFF
charge_complete: DS1 Solid Green
charge_complete: DS2 Water Detect Status
charge_complete: Cell Modem OFF
state "Deployed/GPS" as deployed_gps
deployed_gps: D1 Blink White
deployed_gps: DS1 Charging Status
deployed_gps: DS2 Water Detect Status
deployed_gps: Cell Modem OFF

state "Deployed/No GPS" as deployed_nogps
deployed_nogps: D1 Solid White
deployed_nogps: DS1 Charging Status
deployed_nogps: DS2 Water Detect Status
deployed_nogps: Cell Modem OFF
}

Transmit: D1 Blink Blue
Transmit: DS1 Charging Status
Transmit: DS2 Water Detect Status
Transmit: Cell Modem ON

Charging: D1 OFF
Charging: DS1 Blink Green
Charging: DS2 Water Detect Status
Charging: Cell Modem OFF
state ChargeTask {
state "Charged Complete" as charge_complete
charge_complete: D1 OFF
charge_complete: DS1 Solid Green
charge_complete: DS2 Water Detect Status
charge_complete: Cell Modem OFF

Charging: D1 OFF
Charging: DS1 Blink Green
Charging: DS2 Water Detect Status
Charging: Cell Modem OFF
}

state "CLI" as CLI
CLI: D1 Solid Yellow
CLI: DS1 Charging Status
CLI: DS2 Water Detect Status
CLI: Cell Modem OFF

state "Deployed/GPS" as deployed_gps
deployed_gps: D1 Blink White
deployed_gps: DS1 Charging Status
deployed_gps: DS2 Water Detect Status
deployed_gps: Cell Modem OFF

state choice1 <<choice>>
state choice2 <<choice>>
[*] --> Setup
Setup --> Sleep
Sleep --> choice1 : USB Connect
Sleep --> deployed_nogps : Water Detected
choice1 --> Connect : Data to transmit: Yes
choice1 --> Charging : Data to transmit: No
deployed_nogps --> Sleep : Low Battery
deployed_nogps --> choice2 : Out of water
deployed_nogps --> deployed_gps : GPS Lock
Connect --> Transmit : Connected
Connect --> Sleep : Low Battery or No Connection
Charging --> charge_complete : Charge Complete
Charging --> Sleep : USB Disconnect
Charging --> CLI : "#CLI"
choice2 --> Connect : Data to transmit: Yes
choice2 --> Sleep : Data to transmit: No
deployed_gps --> choice2 : Out of water
deployed_gps --> Sleep : Low Battery
deployed_gps --> deployed_nogps : Lost GPS Lock
charge_complete --> Sleep : USB Disconnect or ~40 days elapsed
CLI --> Connect : Upload Data Command
CLI --> deployed_nogps : Deploy Command
CLI --> Sleep : Sleep Command or CLI timeout
Transmit --> deployed_nogps : Water Detected
Transmit --> Sleep : Transmit Complete or Low Battery
Transmit --> Connect : Lost Connection
[*] -d-> Setup
Setup -d-> Sleep
Sleep -d-> Ride : Water Detected
deployed_nogps -u-> deployed_gps : GPS Lock
deployed_gps -d-> deployed_nogps : Lost GPS Lock
Ride -d-> choice2 : Out of water
choice2 -d-> Connect : Data to transmit
Connect -u-> Transmit : Connected
Transmit -u-> Sleep : Transmit Complete

Sleep -l-> choice1 : USB Connect
choice1 -d-> Connect : Data to transmit
choice1 -l-> ChargeTask : No data to transmit
Charging -d-> charge_complete : Charge Complete
ChargeTask --r--> CLI : "#CLI"
CLI -d--> Connect : Upload Data Command
CLI -d--> Ride : Deploy Command
CLI -l--> Sleep : Sleep Command/CLI timeout
choice2 -u-> Sleep : No data to transmit
DataUpload -u-> Sleep : Low Battery/No Connection
Ride -l-> Sleep : Low Battery
ChargeTask -r-> Sleep : USB Disconnect/~40 days elapsed
DataUpload -r-> Ride : Water Detected
Transmit -d-> Connect : Lost Connection

@enduml
Loading
Loading