Compare commits

..

No commits in common. "develop" and "fix/deep-sleep-timeout-robustness" have entirely different histories.

35 changed files with 6176 additions and 7356 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"board": { "board": {
"active_layer": 2, "active_layer": 0,
"active_layer_preset": "All Layers", "active_layer_preset": "All Layers",
"auto_track_width": false, "auto_track_width": false,
"hidden_netclasses": [], "hidden_netclasses": [],

View File

@ -1102,15 +1102,6 @@
(hide yes) (hide yes)
) )
) )
(property "Sim.Pins" "1=K 2=A"
(at 0 0 0)
(effects
(font
(size 1.27 1.27)
)
(hide yes)
)
)
(property "ki_keywords" "LED diode" (property "ki_keywords" "LED diode"
(at 0 0 0) (at 0 0 0)
(effects (effects
@ -4751,26 +4742,6 @@
) )
(uuid f1cb09e6-74b4-43c4-8247-c9f441069dc5) (uuid f1cb09e6-74b4-43c4-8247-c9f441069dc5)
) )
(text "free"
(exclude_from_sim no)
(at 180.848 72.39 0)
(effects
(font
(size 1.27 1.27)
)
)
(uuid "1556efd1-3aac-45ee-8113-03336077a83d")
)
(text "GPIO21 pulses high during flashing!\nGPIO19 is used for communication during flashing"
(exclude_from_sim no)
(at 202.692 102.362 0)
(effects
(font
(size 1.27 1.27)
)
)
(uuid "2195adc7-ab0b-4ee3-aa2e-b2786571de43")
)
(text "To Allow Wakeup via interrupt" (text "To Allow Wakeup via interrupt"
(exclude_from_sim no) (exclude_from_sim no)
(at 157.734 70.104 0) (at 157.734 70.104 0)
@ -5050,10 +5021,6 @@
(at 31.75 200.66) (at 31.75 200.66)
(uuid "133b7027-41a1-4e09-a1e6-24d8bb033b2a") (uuid "133b7027-41a1-4e09-a1e6-24d8bb033b2a")
) )
(no_connect
(at 184.15 72.39)
(uuid "5a1ba32e-b2ae-4014-aefc-1b75b4dc3c15")
)
(no_connect (no_connect
(at 184.15 67.31) (at 184.15 67.31)
(uuid "6d645bf1-339f-4b38-a26a-bdd168ca591e") (uuid "6d645bf1-339f-4b38-a26a-bdd168ca591e")
@ -6184,7 +6151,7 @@
) )
(global_label "WORKING" (global_label "WORKING"
(shape input) (shape input)
(at 224.79 87.63 0) (at 224.79 72.39 0)
(fields_autoplaced yes) (fields_autoplaced yes)
(effects (effects
(font (font
@ -6194,7 +6161,7 @@
) )
(uuid "0af53f6a-ea11-4d73-a8d1-f63ebcdc2e54") (uuid "0af53f6a-ea11-4d73-a8d1-f63ebcdc2e54")
(property "Intersheetrefs" "${INTERSHEET_REFS}" (property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 235.6482 87.63 0) (at 235.6482 72.39 0)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
@ -6468,6 +6435,28 @@
) )
) )
) )
(global_label "PUMP_ENABLE"
(shape input)
(at 184.15 72.39 180)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify right)
)
(uuid "2e795b18-a106-4105-bbb4-8c45273e4987")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 168.5143 72.39 0)
(effects
(font
(size 1.27 1.27)
)
(justify right)
(hide yes)
)
)
)
(global_label "SDA" (global_label "SDA"
(shape input) (shape input)
(at 224.79 85.09 0) (at 224.79 85.09 0)
@ -6712,22 +6701,44 @@
) )
(global_label "EXTRA_1" (global_label "EXTRA_1"
(shape input) (shape input)
(at 184.15 82.55 180) (at 224.79 92.71 0)
(fields_autoplaced yes) (fields_autoplaced yes)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
) )
(justify right) (justify left)
) )
(uuid "4635eda0-e395-42c7-9764-c7b7fc3019ec") (uuid "4635eda0-e395-42c7-9764-c7b7fc3019ec")
(property "Intersheetrefs" "${INTERSHEET_REFS}" (property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 173.9572 82.55 0) (at 234.9828 92.71 0)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
) )
(justify right) (justify left)
(hide yes)
)
)
)
(global_label "GND"
(shape input)
(at 59.69 135.89 0)
(fields_autoplaced yes)
(effects
(font
(size 1.27 1.27)
)
(justify left)
)
(uuid "472614c1-a2b1-4366-9d8e-904ae5de7b8a")
(property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 65.8915 135.89 0)
(effects
(font
(size 1.27 1.27)
)
(justify left)
(hide yes) (hide yes)
) )
) )
@ -7064,22 +7075,22 @@
) )
(global_label "WARN_LED" (global_label "WARN_LED"
(shape input) (shape input)
(at 224.79 92.71 0) (at 184.15 82.55 180)
(fields_autoplaced yes) (fields_autoplaced yes)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
) )
(justify left) (justify right)
) )
(uuid "63850aa5-2eca-4827-9a2f-c5aed597072f") (uuid "63850aa5-2eca-4827-9a2f-c5aed597072f")
(property "Intersheetrefs" "${INTERSHEET_REFS}" (property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 236.6762 92.71 0) (at 172.2638 82.55 0)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
) )
(justify left) (justify right)
(hide yes) (hide yes)
) )
) )
@ -7328,7 +7339,7 @@
) )
(global_label "EXTRA_2" (global_label "EXTRA_2"
(shape input) (shape input)
(at 224.79 72.39 0) (at 224.79 87.63 0)
(fields_autoplaced yes) (fields_autoplaced yes)
(effects (effects
(font (font
@ -7338,7 +7349,7 @@
) )
(uuid "79c7218b-c7f0-4a6c-8b1d-8ae92200b937") (uuid "79c7218b-c7f0-4a6c-8b1d-8ae92200b937")
(property "Intersheetrefs" "${INTERSHEET_REFS}" (property "Intersheetrefs" "${INTERSHEET_REFS}"
(at 234.9828 72.39 0) (at 234.9828 87.63 0)
(effects (effects
(font (font
(size 1.27 1.27) (size 1.27 1.27)
@ -12065,7 +12076,7 @@
(hide yes) (hide yes)
) )
) )
(property "Description" "Light emitting diode" (property "Description" ""
(at 142.24 115.57 0) (at 142.24 115.57 0)
(effects (effects
(font (font
@ -12099,7 +12110,7 @@
) )
) )
) )
(property "Sim.Pins" "1=K 2=A" (property "Sim.Pins" ""
(at 142.24 115.57 0) (at 142.24 115.57 0)
(effects (effects
(font (font
@ -12287,7 +12298,7 @@
(hide yes) (hide yes)
) )
) )
(property "Description" "Light emitting diode" (property "Description" ""
(at 74.93 337.82 0) (at 74.93 337.82 0)
(effects (effects
(font (font
@ -12321,7 +12332,7 @@
) )
) )
) )
(property "Sim.Pins" "1=K 2=A" (property "Sim.Pins" ""
(at 74.93 337.82 0) (at 74.93 337.82 0)
(effects (effects
(font (font
@ -13620,7 +13631,7 @@
(hide yes) (hide yes)
) )
) )
(property "Description" "Light emitting diode" (property "Description" ""
(at 113.03 107.95 0) (at 113.03 107.95 0)
(effects (effects
(font (font
@ -13654,7 +13665,7 @@
) )
) )
) )
(property "Sim.Pins" "1=K 2=A" (property "Sim.Pins" ""
(at 113.03 107.95 0) (at 113.03 107.95 0)
(effects (effects
(font (font
@ -14377,7 +14388,7 @@
(hide yes) (hide yes)
) )
) )
(property "Description" "Light emitting diode" (property "Description" ""
(at 35.56 337.82 0) (at 35.56 337.82 0)
(effects (effects
(font (font
@ -14411,7 +14422,7 @@
) )
) )
) )
(property "Sim.Pins" "1=K 2=A" (property "Sim.Pins" ""
(at 35.56 337.82 0) (at 35.56 337.82 0)
(effects (effects
(font (font
@ -14928,7 +14939,7 @@
(hide yes) (hide yes)
) )
) )
(property "Description" "Light emitting diode" (property "Description" ""
(at 281.94 101.6 0) (at 281.94 101.6 0)
(effects (effects
(font (font
@ -14962,7 +14973,7 @@
) )
) )
) )
(property "Sim.Pins" "1=K 2=A" (property "Sim.Pins" ""
(at 281.94 101.6 0) (at 281.94 101.6 0)
(effects (effects
(font (font

View File

@ -166,40 +166,40 @@
) )
(pad "7" thru_hole rect (pad "7" thru_hole rect
(at -0.5 -12) (at -0.5 -12)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(uuid "536f0038-06c5-45e5-b1c8-898a364f6ec4") (uuid "536f0038-06c5-45e5-b1c8-898a364f6ec4")
) )
(pad "8" thru_hole rect (pad "8" thru_hole rect
(at 39.5 -16) (at 39.5 -16)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(uuid "3e0cdbaa-8219-48c4-bb0a-fd4f0e78a390") (uuid "3e0cdbaa-8219-48c4-bb0a-fd4f0e78a390")
) )
(pad "9" thru_hole rect (pad "9" thru_hole rect
(at 39.5 22.5) (at 39.5 22.5)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(uuid "f01565c2-eadd-4451-9dea-2ebe28d872f0") (uuid "f01565c2-eadd-4451-9dea-2ebe28d872f0")
) )
(pad "10" thru_hole rect (pad "10" thru_hole rect
(at -0.5 15) (at -0.5 15)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(uuid "56ec7c50-069f-4f46-9b83-ac18e4928930") (uuid "56ec7c50-069f-4f46-9b83-ac18e4928930")
) )
(pad "11" thru_hole rect (pad "11" thru_hole rect
(at -43 22.5) (at -43 22.5)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(uuid "f423be21-13b8-46de-8e19-e48325411a29") (uuid "f423be21-13b8-46de-8e19-e48325411a29")

View File

@ -738,7 +738,7 @@
(type default) (type default)
) )
(layer "F.SilkS") (layer "F.SilkS")
(uuid "23d58535-2840-4798-8fe6-a41e5dd82cfc") (uuid "87f61a83-c9a2-45b6-a235-fe6e83f3dbe3")
) )
(fp_line (fp_line
(start -45 24) (start -45 24)
@ -748,7 +748,7 @@
(type default) (type default)
) )
(layer "F.SilkS") (layer "F.SilkS")
(uuid "ed3c0755-343c-4d19-9481-c2c33348ef82") (uuid "f24175c8-21e2-4899-af70-89e48457e9ba")
) )
(fp_line (fp_line
(start -44 24) (start -44 24)
@ -758,7 +758,7 @@
(type default) (type default)
) )
(layer "F.SilkS") (layer "F.SilkS")
(uuid "cd2e639b-4e20-40a4-8976-6223f2753aeb") (uuid "a884c661-0353-48a0-9bc6-995e02652e36")
) )
(fp_line (fp_line
(start 41 -18) (start 41 -18)
@ -768,7 +768,7 @@
(type default) (type default)
) )
(layer "F.SilkS") (layer "F.SilkS")
(uuid "f34b006e-828a-45d3-b0f5-daad16782ed8") (uuid "675d135e-52c1-4dd1-b434-983f40a2b544")
) )
(fp_line (fp_line
(start 41 24) (start 41 24)
@ -778,7 +778,7 @@
(type default) (type default)
) )
(layer "F.SilkS") (layer "F.SilkS")
(uuid "03fcb85f-a42f-4eab-bf16-6ff7087e0441") (uuid "fbfb2621-73ae-4c15-8403-abdec5cc45cd")
) )
(fp_text user "${REFERENCE}" (fp_text user "${REFERENCE}"
(at 0 2.5 0) (at 0 2.5 0)
@ -860,8 +860,8 @@
) )
(pad "7" thru_hole rect (pad "7" thru_hole rect
(at -0.5 -12) (at -0.5 -12)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(net 1 "GND") (net 1 "GND")
@ -871,8 +871,8 @@
) )
(pad "8" thru_hole rect (pad "8" thru_hole rect
(at 39.5 -16) (at 39.5 -16)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(net 1 "GND") (net 1 "GND")
@ -882,8 +882,8 @@
) )
(pad "9" thru_hole rect (pad "9" thru_hole rect
(at 39.5 22.5) (at 39.5 22.5)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(net 1 "GND") (net 1 "GND")
@ -893,8 +893,8 @@
) )
(pad "10" thru_hole rect (pad "10" thru_hole rect
(at -0.5 15) (at -0.5 15)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(net 1 "GND") (net 1 "GND")
@ -904,8 +904,8 @@
) )
(pad "11" thru_hole rect (pad "11" thru_hole rect
(at -43 22.5) (at -43 22.5)
(size 1.7 1.7) (size 0.85 0.85)
(drill 1) (drill 0.5)
(layers "*.Cu" "*.Mask") (layers "*.Cu" "*.Mask")
(remove_unused_layers no) (remove_unused_layers no)
(net 1 "GND") (net 1 "GND")

Binary file not shown.

View File

@ -7,123 +7,54 @@ P arrayDim N
317VBAT VIA MD0157PA00X+043130Y-035039X0315Y0000R000S3 317VBAT VIA MD0157PA00X+043130Y-035039X0315Y0000R000S3
317GND VIA MD1181PA00X+077500Y-007000X1575Y0000R000S3 317GND VIA MD1181PA00X+077500Y-007000X1575Y0000R000S3
317GND VIA MD0157PA00X+062402Y-010433X0315Y0000R000S3 317GND VIA MD0157PA00X+062402Y-010433X0315Y0000R000S3
317GND VIA MD0157PA00X+054449Y-012323X0315Y0000R000S3 317GND VIA MD0157PA00X+054134Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+044606Y-010551X0315Y0000R000S3 317GND VIA MD0157PA00X+062205Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+054921Y-011417X0315Y0000R000S3 317GND VIA MD0157PA00X+058169Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+050787Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+051772Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+042126Y-008976X0315Y0000R000S3
317GND VIA MD0157PA00X+062205Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+059291Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+058150Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+054843Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+043228Y-012480X0315Y0000R000S3
317GND VIA MD0157PA00X+047244Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+060374Y-011594X0315Y0000R000S3
317GND VIA MD1181PA00X+041500Y-042900X1575Y0000R000S3 317GND VIA MD1181PA00X+041500Y-042900X1575Y0000R000S3
317GND VIA MD0157PA00X+047165Y-011260X0315Y0000R000S3 317GND VIA MD0157PA00X+059685Y-012402X0315Y0000R000S3
317GND VIA MD0157PA00X+042717Y-013031X0315Y0000R000S3 317GND VIA MD0157PA00X+054429Y-011909X0315Y0000R000S3
317GND VIA MD0157PA00X+057008Y-012323X0315Y0000R000S3 317GND VIA MD0157PA00X+053346Y-010925X0315Y0000R000S3
317GND VIA MD0157PA00X+062205Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+062205Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+058917Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+040945Y-035630X0315Y0000R000S3 317GND VIA MD0157PA00X+040945Y-035630X0315Y0000R000S3
317GND VIA MD0157PA00X+059606Y-011575X0315Y0000R000S3
317GND VIA MD1181PA00X+077500Y-042900X1575Y0000R000S3 317GND VIA MD1181PA00X+077500Y-042900X1575Y0000R000S3
317GND VIA MD0157PA00X+046890Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+059055Y-012402X0315Y0000R000S3
317GND VIA MD0157PA00X+054016Y-010591X0315Y0000R000S3 317GND VIA MD0157PA00X+056594Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+046457Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+045039Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+045748Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+051850Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+051260Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+054646Y-011142X0315Y0000R000S3
317GND VIA MD0157PA00X+043819Y-011929X0315Y0000R000S3
317GND VIA MD0157PA00X+046102Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+059646Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+050079Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+056594Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+045118Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+061122Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+061122Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+043346Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+054626Y-010827X0315Y0000R000S3
317GND VIA MD0157PA00X+056693Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+056693Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+044055Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+052559Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+050197Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+048228Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+045669Y-007087X0315Y0000R000S3 317GND VIA MD0157PA00X+045669Y-007087X0315Y0000R000S3
317GND VIA MD0157PA00X+054724Y-012205X0315Y0000R000S3
317GND VIA MD0157PA00X+063386Y-011220X0315Y0000R000S3 317GND VIA MD0157PA00X+063386Y-011220X0315Y0000R000S3
317GND VIA MD0157PA00X+060472Y-012323X0315Y0000R000S3 317GND VIA MD0157PA00X+059685Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+045699Y-017156X0315Y0000R000S3 317GND VIA MD0157PA00X+045699Y-017156X0315Y0000R000S3
317GND VIA MD0157PA00X+048661Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+049724Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+048091Y-016535X0315Y0000R000S3 317GND VIA MD0157PA00X+048091Y-016535X0315Y0000R000S3
317GND VIA MD0157PA00X+053740Y-011220X0315Y0000R000S3
317GND VIA MD0157PA00X+048917Y-031102X0315Y0000R000S3 317GND VIA MD0157PA00X+048917Y-031102X0315Y0000R000S3
317GND VIA MD0157PA00X+056299Y-005591X0315Y0000R000S3 317GND VIA MD0157PA00X+056299Y-005591X0315Y0000R000S3
317GND VIA MD0157PA00X+053858Y-011693X0315Y0000R000S3
317GND VIA MD0157PA00X+049843Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+059232Y-011575X0315Y0000R000S3
317GND VIA MD0157PA00X+055709Y-011220X0315Y0000R000S3 317GND VIA MD0157PA00X+055709Y-011220X0315Y0000R000S3
317GND VIA MD0157PA00X+058169Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+058169Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+044094Y-011654X0315Y0000R000S3
317GND VIA MD0157PA00X+061654Y-008071X0315Y0000R000S3 317GND VIA MD0157PA00X+061654Y-008071X0315Y0000R000S3
317GND VIA MD0157PA00X+050551Y-011260X0315Y0000R000S3 317GND VIA MD0157PA00X+054035Y-010138X0315Y0000R000S3
317GND VIA MD0157PA00X+049370Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+054331Y-010531X0315Y0000R000S3
317GND VIA MD0157PA00X+042402Y-009213X0315Y0000R000S3 317GND VIA MD0157PA00X+055217Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+059980Y-011594X0315Y0000R000S3 317GND VIA MD0157PA00X+056102Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+056181Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+055315Y-011516X0315Y0000R000S3
317GND VIA MD0157PA00X+044409Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+055709Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+055276Y-012323X0315Y0000R000S3 317GND VIA MD0157PA00X+054921Y-011220X0315Y0000R000S3
317GND VIA MD0157PA00X+056181Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+045394Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+060748Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+044685Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+055276Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+051142Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+055748Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+045827Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+052835Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+053189Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+047953Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+052205Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+053780Y-010315X0315Y0000R000S3
317GND VIA MD0157PA00X+046181Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+047283Y-023622X0315Y0000R000S3
317GND VIA MD0157PA00X+051496Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+059843Y-005591X0315Y0000R000S3 317GND VIA MD0157PA00X+059843Y-005591X0315Y0000R000S3
317GND VIA MD0157PA00X+053583Y-011378X0315Y0000R000S3 317GND VIA MD0157PA00X+050787Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+049016Y-034154X0315Y0000R000S3 317GND VIA MD0157PA00X+049016Y-034154X0315Y0000R000S3
317GND VIA MD0157PA00X+045472Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+051772Y-008858X0315Y0000R000S3
317GND VIA MD0157PA00X+058543Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+054331Y-010866X0315Y0000R000S3
317GND VIA MD0157PA00X+046811Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+046555Y-030512X0315Y0000R000S3 317GND VIA MD0157PA00X+046555Y-030512X0315Y0000R000S3
317GND VIA MD0157PA00X+052913Y-009646X0315Y0000R000S3 317GND VIA MD0157PA00X+061122Y-012303X0315Y0000R000S3
317GND VIA MD0157PA00X+043701Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+048307Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+061181Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+049488Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+047520Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+060059Y-012323X0315Y0000R000S3
317GND VIA MD0157PA00X+042283Y-013386X0315Y0000R000S3
317GND VIA MD0157PA00X+044764Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+047205Y-025709X0315Y0000R000S3
317GND VIA MD0157PA00X+055709Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+055709Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+060827Y-012323X0315Y0000R000S3 317GND VIA MD0157PA00X+059055Y-011614X0315Y0000R000S3
317GND VIA MD0157PA00X+054134Y-011969X0315Y0000R000S3
317GND VIA MD0157PA00X+046535Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+043504Y-012205X0315Y0000R000S3
317GND VIA MD1181PA00X+041575Y-007087X1575Y0000R000S3 317GND VIA MD1181PA00X+041575Y-007087X1575Y0000R000S3
317GND VIA MD0157PA00X+050906Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+042992Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+040945Y-034646X0315Y0000R000S3 317GND VIA MD0157PA00X+040945Y-034646X0315Y0000R000S3
317GND VIA MD0157PA00X+063386Y-012598X0315Y0000R000S3 317GND VIA MD0157PA00X+063386Y-012598X0315Y0000R000S3
317GND VIA MD0157PA00X+047598Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+047874Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+042756Y-009291X0315Y0000R000S3
317GND VIA MD0157PA00X+050433Y-009646X0315Y0000R000S3
317GND VIA MD0157PA00X+048583Y-011260X0315Y0000R000S3
317GND VIA MD0157PA00X+048031Y-014567X0315Y0000R000S3 317GND VIA MD0157PA00X+048031Y-014567X0315Y0000R000S3
317GND VIA MD0157PA00X+057185Y-011614X0315Y0000R000S3 317GND VIA MD0157PA00X+057185Y-011516X0315Y0000R000S3
317GND VIA MD0157PA00X+042953Y-012756X0315Y0000R000S3
3173_3V VIA MD0157PA00X+064646Y-014567X0315Y0000R000S3 3173_3V VIA MD0157PA00X+064646Y-014567X0315Y0000R000S3
3173_3V VIA MD0157PA00X+075906Y-014331X0315Y0000R000S3 3173_3V VIA MD0157PA00X+075906Y-014331X0315Y0000R000S3
3173_3V VIA MD0157PA00X+074094Y-014331X0315Y0000R000S3 3173_3V VIA MD0157PA00X+074094Y-014331X0315Y0000R000S3
@ -145,19 +76,79 @@ P arrayDim N
317ISDAY VIA MD0157PA00X+066929Y-011024X0315Y0000R000S3 317ISDAY VIA MD0157PA00X+066929Y-011024X0315Y0000R000S3
317LED_ENABLE VIA MD0157PA00X+064764Y-010728X0315Y0000R000S3 317LED_ENABLE VIA MD0157PA00X+064764Y-010728X0315Y0000R000S3
317WORKING VIA MD0157PA00X+058661Y-011417X0315Y0000R000S3 317WORKING VIA MD0157PA00X+058661Y-011417X0315Y0000R000S3
317WORKING VIA MD0157PA00X+069843Y-008858X0315Y0000R000S3 317WORKING VIA MD0157PA00X+071949Y-008169X0315Y0000R000S3
317ENABLE_TANK VIA MD0157PA00X+062894Y-011516X0315Y0000R000S3 317ENABLE_TANK VIA MD0157PA00X+062894Y-011516X0315Y0000R000S3
317ENABLE_TANK VIA MD0157PA00X+050525Y-015584X0315Y0000R000S3 317ENABLE_TANK VIA MD0157PA00X+050525Y-015584X0315Y0000R000S3
317USB_D- VIA MD0157PA00X+045276Y-010305X0315Y0000R000S3
317USB_D- VIA MD0157PA00X+063377Y-011752X0315Y0000R000S3 317USB_D- VIA MD0157PA00X+063377Y-011752X0315Y0000R000S3
317USB_D- VIA MD0157PA00X+052902Y-009500X0315Y0000R000S3
317FLOW VIA MD0157PA00X+048543Y-023228X0315Y0000R000S3 317FLOW VIA MD0157PA00X+048543Y-023228X0315Y0000R000S3
317FLOW VIA MD0157PA00X+063484Y-007382X0315Y0000R000S3 317FLOW VIA MD0157PA00X+063484Y-007382X0315Y0000R000S3
317USB_D+ VIA MD0157PA00X+045276Y-010719X0315Y0000R000S3
317USB_D+ VIA MD0157PA00X+063377Y-012165X0315Y0000R000S3 317USB_D+ VIA MD0157PA00X+063377Y-012165X0315Y0000R000S3
317USB_D+ VIA MD0157PA00X+052610Y-009792X0315Y0000R000S3
317BOOT_SEL VIA MD0157PA00X+064764Y-009744X0315Y0000R000S3 317BOOT_SEL VIA MD0157PA00X+064764Y-009744X0315Y0000R000S3
317BOOT_SEL VIA MD0157PA00X+070374Y-012205X0315Y0000R000S3 317BOOT_SEL VIA MD0157PA00X+070374Y-012205X0315Y0000R000S3
317WARN_LED VIA MD0157PA00X+069803Y-008465X0315Y0000R000S3
317WARN_LED VIA MD0157PA00X+044390Y-005807X0315Y0000R000S3 317WARN_LED VIA MD0157PA00X+044390Y-005807X0315Y0000R000S3
317WARN_LED VIA MD0157PA00X+063386Y-008268X0315Y0000R000S3
327GND U2 -1 A01X+064094Y-005709X0591Y0354R000S2
3273_3V U2 -2 A01X+064094Y-006209X0591Y0354R000S2
327EN U2 -3 A01X+064094Y-006709X0591Y0354R000S2
327FLOW U2 -4 A01X+064094Y-007209X0591Y0354R000S2
327TANK_SENSOR U2 -5 A01X+064094Y-007709X0591Y0354R000S2
327WARN_LED U2 -6 A01X+064094Y-008209X0591Y0354R000S2
327ISDAY U2 -7 A01X+064094Y-008709X0591Y0354R000S2
327-(U2-IO0-PAD8) U2 -8 A01X+064094Y-009209X0591Y0354R000S2
327BOOT_SEL U2 -9 A01X+064094Y-009709X0591Y0354R000S2
327(U2-IO8-PAD10) U2 -10 A01X+064094Y-010209X0591Y0354R000S2
327LED_ENABLE U2 -11 A01X+064094Y-010709X0591Y0354R000S2
327ENABLE_TANK U2 -12 A01X+064094Y-011209X0591Y0354R000S2
327USB_D- U2 -13 A01X+064094Y-011709X0591Y0354R000S2
327USB_D+ U2 -14 A01X+064094Y-012209X0591Y0354R000S2
327BOOT_SEL U2 -15 A01X+070984Y-012209X0591Y0354R000S2
327TEMP U2 -16 A01X+070984Y-011709X0591Y0354R000S2
327SCL U2 -17 A01X+070984Y-011209X0591Y0354R000S2
327SDA U2 -18 A01X+070984Y-010709X0591Y0354R000S2
327EXTRA_2 U2 -19 A01X+070984Y-010209X0591Y0354R000S2
327CD_PROBE U2 -20 A01X+070984Y-009709X0591Y0354R000S2
327EXTRA_1 U2 -21 A01X+070984Y-009209X0591Y0354R000S2
327-(U2-NC-PAD22) U2 -22 A01X+070984Y-008709X0591Y0354R000S2
327WORKING U2 -23 A01X+070984Y-008209X0591Y0354R000S2
327ESP_RX U2 -24 A01X+070984Y-007709X0591Y0354R000S2
327ESP_TX U2 -25 A01X+070984Y-007209X0591Y0354R000S2
327CHARGE U2 -26 A01X+070984Y-006709X0591Y0354R000S2
327PUMP_ENABLE U2 -27 A01X+070984Y-006209X0591Y0354R000S2
327GND U2 -28 A01X+070984Y-005709X0591Y0354R000S2
327GND U2 -29_5 A01X+066947Y-007961X0315Y0315R000S2
327GND U2 -29_1 A01X+066455Y-007469X0315Y0315R000S2
327GND U2 -29_2 A01X+066947Y-007469X0315Y0315R000S2
327GND U2 -29_3 A01X+067439Y-007469X0315Y0315R000S2
327GND U2 -29_4 A01X+066455Y-007961X0315Y0315R000S2
327GND U2 -29_6 A01X+067439Y-007961X0315Y0315R000S2
327GND U2 -29_7 A01X+066455Y-008453X0315Y0315R000S2
327GND U2 -29_8 A01X+066947Y-008453X0315Y0315R000S2
327GND U2 -29_9 A01X+067439Y-008453X0315Y0315R000S2
317GND U2 -30_1 D0098PA00X+066701Y-007469X0138Y0000R000S3
317GND U2 -30_2 D0098PA00X+067193Y-007469X0138Y0000R000S3
317GND U2 -30_3 D0098PA00X+066455Y-007715X0138Y0000R000S3
317GND U2 -30_4 D0098PA00X+066947Y-007715X0138Y0000R000S3
317GND U2 -30_5 D0098PA00X+067439Y-007715X0138Y0000R000S3
317GND U2 -30_6 D0098PA00X+066701Y-007961X0138Y0000R000S3
317GND U2 -30_7 D0098PA00X+067193Y-007961X0138Y0000R000S3
317GND U2 -30_8 D0098PA00X+066455Y-008207X0138Y0000R000S3
317GND U2 -30_9 D0098PA00X+066947Y-008207X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+067439Y-008207X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+066701Y-008453X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+067193Y-008453X0138Y0000R000S3
3173_3V U5 -1 D0394PA00X+046339Y-019764X0669Y0669R000S0
317(U5-VBAT-PAD2) U5 -2 D0394PA00X+046339Y-020764X0669Y0000R000S0
317SDA U5 -3 D0394PA00X+046339Y-021764X0669Y0000R000S0
317SCL U5 -4 D0394PA00X+046339Y-022764X0669Y0000R000S0
317CD_PROBE U5 -5 D0394PA00X+046339Y-023764X0669Y0000R000S0
317GND U5 -6 D0394PA00X+046339Y-024764X0669Y0000R000S0
317GND U5 -7 D0197PA00X+062835Y-021063X0335Y0335R000S0
317GND U5 -8 D0197PA00X+078583Y-019488X0335Y0335R000S0
317GND U5 -9 D0197PA00X+078583Y-034646X0335Y0335R000S0
317GND U5 -10 D0197PA00X+062835Y-031693X0335Y0335R000S0
317GND U5 -11 D0197PA00X+046102Y-034646X0335Y0335R000S0
327GND D11 -1 A01X+046506Y-030000X0581Y0236R180S2 327GND D11 -1 A01X+046506Y-030000X0581Y0236R180S2
327VBAT D11 -2 A01X+046506Y-029252X0581Y0236R180S2 327VBAT D11 -2 A01X+046506Y-029252X0581Y0236R180S2
327NET-(D10-K) D11 -3 A01X+045768Y-029626X0581Y0236R180S2 327NET-(D10-K) D11 -3 A01X+045768Y-029626X0581Y0236R180S2
@ -206,9 +197,9 @@ P arrayDim N
327GND R16 -2 A01X+048091Y-016043X0315Y0374R180S2 327GND R16 -2 A01X+048091Y-016043X0315Y0374R180S2
327NET-(Q2-G) R22 -1 A01X+047805Y-034843X0315Y0374R000S2 327NET-(Q2-G) R22 -1 A01X+047805Y-034843X0315Y0374R000S2
327GND R22 -2 A01X+048455Y-034843X0315Y0374R000S2 327GND R22 -2 A01X+048455Y-034843X0315Y0374R000S2
327GND D5 -1 A01X+048027Y-023602X0581Y0236R180S2
3273_3V D5 -2 A01X+048027Y-022854X0581Y0236R180S2
327FLOW D5 -3 A01X+047288Y-023228X0581Y0236R180S2 327FLOW D5 -3 A01X+047288Y-023228X0581Y0236R180S2
3273_3V D5 -2 A01X+048027Y-022854X0581Y0236R180S2
327GND D5 -1 A01X+048027Y-023602X0581Y0236R180S2
327NET-(D2-K) D2 -1 A01X+043701Y-006570X0384Y0551R270S2 327NET-(D2-K) D2 -1 A01X+043701Y-006570X0384Y0551R270S2
327WARN_LED D2 -2 A01X+043701Y-005832X0384Y0551R270S2 327WARN_LED D2 -2 A01X+043701Y-005832X0384Y0551R270S2
327GND D6 -1 A01X+046043Y-016811X0581Y0236R180S2 327GND D6 -1 A01X+046043Y-016811X0581Y0236R180S2
@ -216,25 +207,25 @@ P arrayDim N
327TANK_SENSOR D6 -3 A01X+045305Y-016437X0581Y0236R180S2 327TANK_SENSOR D6 -3 A01X+045305Y-016437X0581Y0236R180S2
327NET-(CD1-A) R9 -1 A01X+058661Y-010305X0315Y0374R090S2 327NET-(CD1-A) R9 -1 A01X+058661Y-010305X0315Y0374R090S2
327WORKING R9 -2 A01X+058661Y-010955X0315Y0374R090S2 327WORKING R9 -2 A01X+058661Y-010955X0315Y0374R090S2
317GND J6 -1 D0394PA00X+051921Y-008228X0669Y0669R090S0 317GND J6 -1 D0394PA00X+041319Y-014661X0669Y0669R180S0
3173_3V J6 -2 D0394PA00X+050921Y-008228X0669Y0000R090S0 3173_3V J6 -2 D0394PA00X+041319Y-013661X0669Y0000R180S0
317SDA J6 -3 D0394PA00X+049921Y-008228X0669Y0000R090S0 317SDA J6 -3 D0394PA00X+041319Y-012661X0669Y0000R180S0
317SCL J6 -4 D0394PA00X+048921Y-008228X0669Y0000R090S0 317SCL J6 -4 D0394PA00X+041319Y-011661X0669Y0000R180S0
317SQW J6 -5 D0394PA00X+047921Y-008228X0669Y0000R090S0 317SQW J6 -5 D0394PA00X+041319Y-010661X0669Y0000R180S0
31732K J6 -6 D0394PA00X+046921Y-008228X0669Y0000R090S0 31732K J6 -6 D0394PA00X+041319Y-009661X0669Y0000R180S0
327NET-(D8-K) D8 -1 A01X+040945Y-033243X0384Y0551R270S2 327NET-(D8-K) D8 -1 A01X+040945Y-033243X0384Y0551R270S2
327NET-(D8-A) D8 -2 A01X+040945Y-032505X0384Y0551R270S2 327NET-(D8-A) D8 -2 A01X+040945Y-032505X0384Y0551R270S2
327NET-(J2-PIN_2) R2 -1 A01X+042943Y-014764X0315Y0374R000S2 327NET-(J2-PIN_2) R2 -1 A01X+046457Y-005581X0315Y0374R090S2
327GND R2 -2 A01X+043593Y-014764X0315Y0374R000S2 327GND R2 -2 A01X+046457Y-006230X0315Y0374R090S2
327USB_D+ U1 -1 A01X+044124Y-010945X0522Y0236R180S2 327USB_D+ U1 -1 A01X+050251Y-009286X0522Y0236R180S2
327GND U1 -2 A01X+044124Y-010571X0522Y0236R180S2 327GND U1 -2 A01X+050251Y-008912X0522Y0236R180S2
327USB_D- U1 -3 A01X+044124Y-010197X0522Y0236R180S2 327USB_D- U1 -3 A01X+050251Y-008538X0522Y0236R180S2
327SLASH}O2-PAD4) U1 -4 A01X+043228Y-010197X0522Y0236R180S2 327SLASH}O2-PAD4) U1 -4 A01X+049355Y-008538X0522Y0236R180S2
327USB_BUS U1 -5 A01X+043228Y-010571X0522Y0236R180S2 327USB_BUS U1 -5 A01X+049355Y-008912X0522Y0236R180S2
327SLASH}O1-PAD6) U1 -6 A01X+043228Y-010945X0522Y0236R180S2 327SLASH}O1-PAD6) U1 -6 A01X+049355Y-009286X0522Y0236R180S2
327GND D7 -1 A01X+048027Y-025669X0581Y0236R180S2
3273_3V D7 -2 A01X+048027Y-024921X0581Y0236R180S2
327TEMP D7 -3 A01X+047288Y-025295X0581Y0236R180S2 327TEMP D7 -3 A01X+047288Y-025295X0581Y0236R180S2
3273_3V D7 -2 A01X+048027Y-024921X0581Y0236R180S2
327GND D7 -1 A01X+048027Y-025669X0581Y0236R180S2
327VBAT C8 -1 A01X+042534Y-036024X0463Y0571R180S2 327VBAT C8 -1 A01X+042534Y-036024X0463Y0571R180S2
327GND C8 -2 A01X+041718Y-036024X0463Y0571R180S2 327GND C8 -2 A01X+041718Y-036024X0463Y0571R180S2
327NET-(R3-PAD1) R3 -1 A01X+057677Y-012933X0315Y0374R090S2 327NET-(R3-PAD1) R3 -1 A01X+057677Y-012933X0315Y0374R090S2
@ -270,59 +261,10 @@ P arrayDim N
327BOOT_SEL C5 -2 A01X+062992Y-009700X0423Y0374R270S2 327BOOT_SEL C5 -2 A01X+062992Y-009700X0423Y0374R270S2
327TANK_SENSOR R12 -1 A01X+047215Y-016831X0404Y0551R270S2 327TANK_SENSOR R12 -1 A01X+047215Y-016831X0404Y0551R270S2
3273_3V R12 -2 A01X+047215Y-016112X0404Y0551R270S2 3273_3V R12 -2 A01X+047215Y-016112X0404Y0551R270S2
327NET-(D2-K) R1 -1 A01X+044488Y-008317X0315Y0374R270S2 327NET-(D2-K) R1 -1 A01X+045935Y-007874X0315Y0374R000S2
327GND R1 -2 A01X+044488Y-007667X0315Y0374R270S2 327GND R1 -2 A01X+046585Y-007874X0315Y0374R000S2
327EXTRA_1 R20 -1 A01X+048455Y-031890X0315Y0374R180S2 327EXTRA_1 R20 -1 A01X+048455Y-031890X0315Y0374R180S2
327NET-(Q3-G) R20 -2 A01X+047805Y-031890X0315Y0374R180S2 327NET-(Q3-G) R20 -2 A01X+047805Y-031890X0315Y0374R180S2
327GND U2 -1 A01X+064094Y-005709X0591Y0354R000S2
3273_3V U2 -2 A01X+064094Y-006209X0591Y0354R000S2
327EN U2 -3 A01X+064094Y-006709X0591Y0354R000S2
327FLOW U2 -4 A01X+064094Y-007209X0591Y0354R000S2
327TANK_SENSOR U2 -5 A01X+064094Y-007709X0591Y0354R000S2
327EXTRA_1 U2 -6 A01X+064094Y-008209X0591Y0354R000S2
327ISDAY U2 -7 A01X+064094Y-008709X0591Y0354R000S2
327-(U2-IO0-PAD8) U2 -8 A01X+064094Y-009209X0591Y0354R000S2
327BOOT_SEL U2 -9 A01X+064094Y-009709X0591Y0354R000S2
327(U2-IO8-PAD10) U2 -10 A01X+064094Y-010209X0591Y0354R000S2
327LED_ENABLE U2 -11 A01X+064094Y-010709X0591Y0354R000S2
327ENABLE_TANK U2 -12 A01X+064094Y-011209X0591Y0354R000S2
327USB_D- U2 -13 A01X+064094Y-011709X0591Y0354R000S2
327USB_D+ U2 -14 A01X+064094Y-012209X0591Y0354R000S2
327BOOT_SEL U2 -15 A01X+070984Y-012209X0591Y0354R000S2
327TEMP U2 -16 A01X+070984Y-011709X0591Y0354R000S2
327SCL U2 -17 A01X+070984Y-011209X0591Y0354R000S2
327SDA U2 -18 A01X+070984Y-010709X0591Y0354R000S2
327WORKING U2 -19 A01X+070984Y-010209X0591Y0354R000S2
327CD_PROBE U2 -20 A01X+070984Y-009709X0591Y0354R000S2
327WARN_LED U2 -21 A01X+070984Y-009209X0591Y0354R000S2
327-(U2-NC-PAD22) U2 -22 A01X+070984Y-008709X0591Y0354R000S2
327EXTRA_2 U2 -23 A01X+070984Y-008209X0591Y0354R000S2
327ESP_RX U2 -24 A01X+070984Y-007709X0591Y0354R000S2
327ESP_TX U2 -25 A01X+070984Y-007209X0591Y0354R000S2
327CHARGE U2 -26 A01X+070984Y-006709X0591Y0354R000S2
327PUMP_ENABLE U2 -27 A01X+070984Y-006209X0591Y0354R000S2
327GND U2 -28 A01X+070984Y-005709X0591Y0354R000S2
327GND U2 -29_1 A01X+066455Y-007469X0315Y0315R000S2
327GND U2 -29_2 A01X+066947Y-007469X0315Y0315R000S2
327GND U2 -29_3 A01X+067439Y-007469X0315Y0315R000S2
327GND U2 -29_4 A01X+066455Y-007961X0315Y0315R000S2
327GND U2 -29_5 A01X+066947Y-007961X0315Y0315R000S2
327GND U2 -29_6 A01X+067439Y-007961X0315Y0315R000S2
327GND U2 -29_7 A01X+066455Y-008453X0315Y0315R000S2
327GND U2 -29_8 A01X+066947Y-008453X0315Y0315R000S2
327GND U2 -29_9 A01X+067439Y-008453X0315Y0315R000S2
317GND U2 -30_1 D0098PA00X+066701Y-007469X0138Y0000R000S3
317GND U2 -30_2 D0098PA00X+067193Y-007469X0138Y0000R000S3
317GND U2 -30_3 D0098PA00X+066455Y-007715X0138Y0000R000S3
317GND U2 -30_4 D0098PA00X+066947Y-007715X0138Y0000R000S3
317GND U2 -30_5 D0098PA00X+067439Y-007715X0138Y0000R000S3
317GND U2 -30_6 D0098PA00X+066701Y-007961X0138Y0000R000S3
317GND U2 -30_7 D0098PA00X+067193Y-007961X0138Y0000R000S3
317GND U2 -30_8 D0098PA00X+066455Y-008207X0138Y0000R000S3
317GND U2 -30_9 D0098PA00X+066947Y-008207X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+067439Y-008207X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+066701Y-008453X0138Y0000R000S3
317GND U2 -30_1 D0098PA00X+067193Y-008453X0138Y0000R000S3
317NET-(D10-K) Extra_-1 D0394PA00X+042283Y-029616X0669Y0787R270S0 317NET-(D10-K) Extra_-1 D0394PA00X+042283Y-029616X0669Y0787R270S0
317VBAT Extra_-2 D0394PA00X+042283Y-028632X0669Y0787R270S0 317VBAT Extra_-2 D0394PA00X+042283Y-028632X0669Y0787R270S0
327GND D1 -1 A01X+047441Y-014469X0581Y0236R180S2 327GND D1 -1 A01X+047441Y-014469X0581Y0236R180S2
@ -334,19 +276,8 @@ P arrayDim N
327NET-(Q2-G) R23 -2 A01X+047805Y-035728X0315Y0374R180S2 327NET-(Q2-G) R23 -2 A01X+047805Y-035728X0315Y0374R180S2
327VBAT R18 -1 A01X+046033Y-028445X0315Y0374R000S2 327VBAT R18 -1 A01X+046033Y-028445X0315Y0374R000S2
327NET-(D10-A) R18 -2 A01X+046683Y-028445X0315Y0374R000S2 327NET-(D10-A) R18 -2 A01X+046683Y-028445X0315Y0374R000S2
3173_3V U5 -1 D0394PA00X+046339Y-019764X0669Y0669R000S0 327NET-(J2-PIN_5) R4 -1 A01X+053150Y-005581X0315Y0374R090S2
317(U5-VBAT-PAD2) U5 -2 D0394PA00X+046339Y-020764X0669Y0000R000S0 327GND R4 -2 A01X+053150Y-006230X0315Y0374R090S2
317SDA U5 -3 D0394PA00X+046339Y-021764X0669Y0000R000S0
317SCL U5 -4 D0394PA00X+046339Y-022764X0669Y0000R000S0
317CD_PROBE U5 -5 D0394PA00X+046339Y-023764X0669Y0000R000S0
317GND U5 -6 D0394PA00X+046339Y-024764X0669Y0000R000S0
317GND U5 -7 D0394PA00X+062835Y-021063X0669Y0669R000S0
317GND U5 -8 D0394PA00X+078583Y-019488X0669Y0669R000S0
317GND U5 -9 D0394PA00X+078583Y-034646X0669Y0669R000S0
317GND U5 -10 D0394PA00X+062835Y-031693X0669Y0669R000S0
317GND U5 -11 D0394PA00X+046102Y-034646X0669Y0669R000S0
327NET-(J2-PIN_3) R4 -1 A01X+042943Y-014134X0315Y0374R000S2
327GND R4 -2 A01X+043593Y-014134X0315Y0374R000S2
327NET-(D10-K) D10 -1 A01X+040945Y-029542X0384Y0551R270S2 327NET-(D10-K) D10 -1 A01X+040945Y-029542X0384Y0551R270S2
327NET-(D10-A) D10 -2 A01X+040945Y-028804X0384Y0551R270S2 327NET-(D10-A) D10 -2 A01X+040945Y-028804X0384Y0551R270S2
317NET-(J4-PIN_1) J4 -1 D0295PA00X+042323Y-017638X0472Y0689R270S0 317NET-(J4-PIN_1) J4 -1 D0295PA00X+042323Y-017638X0472Y0689R270S0
@ -366,12 +297,12 @@ P arrayDim N
327NET-(CD1-A) CD1 -2 A01X+045177Y-005832X0384Y0551R270S2 327NET-(CD1-A) CD1 -2 A01X+045177Y-005832X0384Y0551R270S2
327GND C4 -1 A01X+060630Y-011166X0423Y0374R270S2 327GND C4 -1 A01X+060630Y-011166X0423Y0374R270S2
327NET-(C4-PAD2) C4 -2 A01X+060630Y-010487X0423Y0374R270S2 327NET-(C4-PAD2) C4 -2 A01X+060630Y-010487X0423Y0374R270S2
317USB_BUS J2 -1 D0295PA00X+041260Y-009803X0472Y0689R090S0 317USB_BUS J2 -1 D0295PA00X+047835Y-006142X0472Y0689R000S0
317NET-(J2-PIN_2) J2 -2 D0295PA00X+041260Y-010591X0472Y0689R090S0 317NET-(J2-PIN_2) J2 -2 D0295PA00X+048622Y-006142X0472Y0689R000S0
317NET-(J2-PIN_3) J2 -3 D0295PA00X+041260Y-011378X0472Y0689R090S0 317USB_D+ J2 -3 D0295PA00X+049409Y-006142X0472Y0689R000S0
317USB_D- J2 -4 D0295PA00X+041260Y-012165X0472Y0689R090S0 317USB_D- J2 -4 D0295PA00X+050197Y-006142X0472Y0689R000S0
317USB_D+ J2 -5 D0295PA00X+041260Y-012953X0472Y0689R090S0 317NET-(J2-PIN_5) J2 -5 D0295PA00X+050984Y-006142X0472Y0689R000S0
317GND J2 -6 D0295PA00X+041260Y-013740X0472Y0689R090S0 317GND J2 -6 D0295PA00X+051772Y-006142X0472Y0689R000S0
3273_3V R15 -1 A01X+049680Y-023228X0315Y0374R180S2 3273_3V R15 -1 A01X+049680Y-023228X0315Y0374R180S2
327FLOW R15 -2 A01X+049031Y-023228X0315Y0374R180S2 327FLOW R15 -2 A01X+049031Y-023228X0315Y0374R180S2
327NET-(Q1-G) Q1 -1 A01X+048770Y-016831X0354Y0315R090S2 327NET-(Q1-G) Q1 -1 A01X+048770Y-016831X0354Y0315R090S2
@ -382,9 +313,9 @@ P arrayDim N
327NET-(Q2-G) Q2 -1 A01X+047776Y-034142X0354Y0315R270S2 327NET-(Q2-G) Q2 -1 A01X+047776Y-034142X0354Y0315R270S2
327GND Q2 -2 A01X+048524Y-034142X0354Y0315R270S2 327GND Q2 -2 A01X+048524Y-034142X0354Y0315R270S2
327NET-(D8-K) Q2 -3 A01X+048150Y-033354X0354Y0315R270S2 327NET-(D8-K) Q2 -3 A01X+048150Y-033354X0354Y0315R270S2
317VBAT U7 -1 D0433PA00X+042795Y-037835X0750Y0787R180S0 317VBAT U7 -1 D0433PA00X+042795Y-040315X0750Y0787R180S0
317GND U7 -2 D0433PA00X+041795Y-037835X0750Y0787R180S0 317GND U7 -2 D0433PA00X+041795Y-040315X0750Y0787R180S0
3173_3V U7 -3 D0433PA00X+040795Y-037835X0750Y0787R180S0 3173_3V U7 -3 D0433PA00X+040795Y-040315X0750Y0787R180S0
317GND J1 -1 D0394PA00X+044882Y-012047X0669Y0669R000S0 317GND J1 -1 D0394PA00X+044882Y-012047X0669Y0669R000S0
317SCL J1 -2 D0394PA00X+044882Y-013047X0669Y0000R000S0 317SCL J1 -2 D0394PA00X+044882Y-013047X0669Y0000R000S0
317SDA J1 -3 D0394PA00X+044882Y-014047X0669Y0000R000S0 317SDA J1 -3 D0394PA00X+044882Y-014047X0669Y0000R000S0

View File

@ -5,8 +5,8 @@ target = "riscv32imac-esp-espidf"
[target.riscv32imac-esp-espidf] [target.riscv32imac-esp-espidf]
linker = "ldproxy" linker = "ldproxy"
#runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv -b no-reset" # Select this runner in case of usb ttl #runner = "espflash flash --monitor --baud 921600 --partition-table partitions.csv -b no-reset" # Select this runner in case of usb ttl
#runner = "espflash flash --monitor" runner = "espflash flash --monitor --baud 921600 --flash-size 16mb --partition-table partitions.csv"
runner = "cargo runner" #runner = "cargo runner"
#runner = "espflash flash --monitor --partition-table partitions.csv -b no-reset" # create upgrade image file for webupload #runner = "espflash flash --monitor --partition-table partitions.csv -b no-reset" # create upgrade image file for webupload

View File

@ -1,14 +1,7 @@
<component name="ProjectDictionaryState"> <component name="ProjectDictionaryState">
<dictionary name="project"> <dictionary name="project">
<words> <words>
<w>buildtime</w>
<w>deepsleep</w>
<w>githash</w>
<w>lightstate</w>
<w>mppt</w>
<w>plantstate</w>
<w>sntp</w> <w>sntp</w>
<w>vergen</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>

View File

@ -38,13 +38,13 @@ command = [
partition_table = "partitions.csv" partition_table = "partitions.csv"
[features] [features]
default = ["std", "esp-idf-svc/native"] default = ["std", "embassy", "esp-idf-svc/native"]
pio = ["esp-idf-svc/pio"] pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"] std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"] alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"] nightly = ["esp-idf-svc/nightly"]
experimental = ["esp-idf-svc/experimental"] experimental = ["esp-idf-svc/experimental"]
#embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"] embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]
[dependencies] [dependencies]
#ESP stuff #ESP stuff

View File

@ -22,22 +22,6 @@ fn main() {
println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success()); assert!(output.status.success());
// move webpack results to rust webserver src
let _ = Command::new("cmd")
.arg("/K")
.arg("move")
.arg("./src_webpack/bundle.js")
.arg("./src/webserver")
.output()
.unwrap();
let _ = Command::new("cmd")
.arg("/K")
.arg("move")
.arg("./src_webpack/index.html")
.arg("./src/webserver")
.output()
.unwrap();
} }
Err(_) => { Err(_) => {
println!("Assuming build on linux"); println!("Assuming build on linux");
@ -50,18 +34,6 @@ fn main() {
println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
assert!(output.status.success()); assert!(output.status.success());
// move webpack results to rust webserver src
let _ = Command::new("mv")
.arg("./src_webpack/bundle.js")
.arg("./src/webserver")
.output()
.unwrap();
let _ = Command::new("mv")
.arg("./src_webpack/index.html")
.arg("./src/webserver")
.output()
.unwrap();
} }
} }

View File

@ -1,6 +0,0 @@
partition_table="partitions.csv"
[connection]
serial = "/dev/ttyACM0"
baudrate = 921600
[flash]
size = "16MB"

View File

@ -1,6 +1,6 @@
nvs, data, nvs, , 16k, nvs, data, nvs, , 16k,
otadata, data, ota, , 8k, otadata, data, ota, , 8k,
phy_init, data, phy, , 4k, phy_init, data, phy, , 4k,
ota_0, app, ota_0, , 3968k, ota_0, app, ota_0, , 5632k,
ota_1, app, ota_0, , 3968k, ota_1, app, ota_1, , 5632k,
storage, data, spiffs, , 8M, storage, data, spiffs, , 5000k,
1 nvs data nvs 16k
2 otadata data ota 8k
3 phy_init data phy 4k
4 ota_0 app ota_0 3968k 5632k
5 ota_1 app ota_0 ota_1 3968k 5632k
6 storage data spiffs 8M 5000k

View File

@ -1,3 +1,4 @@
use crate::to_string;
use anyhow::anyhow; use anyhow::anyhow;
use bq34z100::{Bq34Z100Error, Bq34z100g1, Bq34z100g1Driver}; use bq34z100::{Bq34Z100Error, Bq34z100g1, Bq34z100g1Driver};
use embedded_hal_bus::i2c::MutexDevice; use embedded_hal_bus::i2c::MutexDevice;
@ -97,7 +98,6 @@ impl BatteryInteraction for NoBatteryMonitor {
} }
//TODO implement this battery monitor kind once controller is complete //TODO implement this battery monitor kind once controller is complete
#[allow(dead_code)]
pub struct WchI2cSlave {} pub struct WchI2cSlave {}
pub struct BQ34Z100G1<'a> { pub struct BQ34Z100G1<'a> {

View File

@ -63,14 +63,14 @@ pub struct MqttClient<'a> {
mqtt_client: EspMqttClient<'a>, mqtt_client: EspMqttClient<'a>,
base_topic: heapless::String<64>, base_topic: heapless::String<64>,
} }
pub struct Esp<'a> { pub struct ESP<'a> {
pub(crate) mqtt_client: Option<MqttClient<'a>>, pub(crate) mqtt_client: Option<MqttClient<'a>>,
pub(crate) wifi_driver: EspWifi<'a>, pub(crate) wifi_driver: EspWifi<'a>,
pub(crate) boot_button: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>, pub(crate) boot_button: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>,
pub(crate) delay: Delay, pub(crate) delay: Delay,
} }
impl Esp<'_> { impl ESP<'_> {
const SPIFFS_PARTITION_NAME: &'static str = "storage"; const SPIFFS_PARTITION_NAME: &'static str = "storage";
const CONFIG_FILE: &'static str = "/spiffs/config.cfg"; const CONFIG_FILE: &'static str = "/spiffs/config.cfg";
const BASE_PATH: &'static str = "/spiffs"; const BASE_PATH: &'static str = "/spiffs";
@ -310,7 +310,7 @@ impl Esp<'_> {
filename: file.file_name().into_string().unwrap(), filename: file.file_name().into_string().unwrap(),
size: file size: file
.metadata() .metadata()
.map(|it| it.len()) .and_then(|it| Ok(it.len()))
.unwrap_or_default() .unwrap_or_default()
as usize, as usize,
}; };

View File

@ -1,19 +1,16 @@
use crate::hal::esp::Esp; use crate::config::{BoardHardware, PlantControllerConfig};
use crate::hal::battery::{BatteryInteraction, NoBatteryMonitor};
use crate::hal::esp::ESP;
use crate::hal::{deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor}; use crate::hal::{deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor};
use crate::{
config::PlantControllerConfig,
hal::battery::{BatteryInteraction, NoBatteryMonitor},
};
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use embedded_hal::digital::OutputPin; use embedded_hal::digital::OutputPin;
use esp_idf_hal::gpio::{IOPin, Pull}; use esp_idf_hal::gpio::{IOPin, Pull};
use esp_idf_hal::gpio::{InputOutput, PinDriver}; use esp_idf_hal::gpio::{InputOutput, PinDriver};
use measurements::{Current, Voltage};
pub struct Initial<'a> { pub struct Initial<'a> {
pub(crate) general_fault: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, pub(crate) general_fault: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
pub(crate) esp: Esp<'a>, pub(crate) esp: ESP<'a>,
pub(crate) config: PlantControllerConfig, pub(crate) config: PlantControllerConfig,
pub(crate) battery: Box<dyn BatteryInteraction + Send>, pub(crate) battery: Box<dyn BatteryInteraction + Send>,
} }
@ -22,7 +19,7 @@ pub(crate) fn create_initial_board(
free_pins: FreePeripherals, free_pins: FreePeripherals,
fs_mount_error: bool, fs_mount_error: bool,
config: PlantControllerConfig, config: PlantControllerConfig,
esp: Esp<'static>, esp: ESP<'static>,
) -> Result<Box<dyn BoardInteraction<'static> + Send>> { ) -> Result<Box<dyn BoardInteraction<'static> + Send>> {
let mut general_fault = PinDriver::input_output(free_pins.gpio6.downgrade())?; let mut general_fault = PinDriver::input_output(free_pins.gpio6.downgrade())?;
general_fault.set_pull(Pull::Floating)?; general_fault.set_pull(Pull::Floating)?;
@ -41,7 +38,7 @@ pub(crate) fn create_initial_board(
} }
impl<'a> BoardInteraction<'a> for Initial<'a> { impl<'a> BoardInteraction<'a> for Initial<'a> {
fn get_esp(&mut self) -> &mut Esp<'a> { fn get_esp(&mut self) -> &mut ESP<'a> {
&mut self.esp &mut self.esp
} }
@ -53,7 +50,7 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
&mut self.battery &mut self.battery
} }
fn set_charge_indicator(&mut self, _charging: bool) -> Result<()> { fn set_charge_indicator(&mut self, charging: bool) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
@ -69,7 +66,7 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn backup_config(&mut self, _bytes: &[u8]) -> Result<()> { fn backup_config(&mut self, bytes: &[u8]) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
@ -84,17 +81,17 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
fn tank_sensor_voltage(&mut self) -> Result<f32> { fn tank_sensor_voltage(&mut self) -> Result<f32> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn light(&mut self, _enable: bool) -> Result<()> { fn light(&mut self, enable: bool) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn pump(&mut self, _plant: usize, _enable: bool) -> Result<()> { fn pump(&mut self, plant: usize, enable: bool) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn fault(&mut self, _plant: usize, _enable: bool) -> Result<()> { fn fault(&mut self, plant: usize, _enable: bool) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn measure_moisture_hz(&mut self, _plant: usize, _sensor: Sensor) -> Result<f32> { fn measure_moisture_hz(&mut self, plant: usize, sensor: Sensor) -> Result<f32> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
@ -110,10 +107,10 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn set_rtc_time(&mut self, _time: &DateTime<Utc>) -> Result<()> { fn set_rtc_time(&mut self, time: &DateTime<Utc>) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
fn test_pump(&mut self, _plant: usize) -> Result<()> { fn test_pump(&mut self, plant: usize) -> Result<()> {
bail!("Please configure board revision") bail!("Please configure board revision")
} }
@ -126,12 +123,4 @@ impl<'a> BoardInteraction<'a> for Initial<'a> {
self.esp.save_config(&self.config)?; self.esp.save_config(&self.config)?;
anyhow::Ok(()) anyhow::Ok(())
} }
fn get_mptt_voltage(&mut self) -> Result<Voltage> {
bail!("Please configure board revision")
}
fn get_mptt_current(&mut self) -> Result<Current> {
bail!("Please configure board revision")
}
} }

View File

@ -4,46 +4,54 @@ mod initial_hal;
mod v3_hal; mod v3_hal;
mod v4_hal; mod v4_hal;
use crate::{
config::{BatteryBoardVersion, BoardVersion, PlantControllerConfig},
hal::{
battery::{print_battery_bq34z100, BatteryInteraction, NoBatteryMonitor},
esp::Esp,
},
log::{log, LogMessage},
};
use anyhow::{Ok, Result};
use battery::BQ34Z100G1; use battery::BQ34Z100G1;
use bq34z100::Bq34z100g1Driver; use bq34z100::Bq34z100g1Driver;
use chrono::{DateTime, Utc};
use crate::log::LogMessage;
use ds323x::DateTimeAccess;
use esp_ota::mark_app_valid;
use eeprom24x::Eeprom24xTrait;
use embedded_hal_bus::i2c::MutexDevice; use embedded_hal_bus::i2c::MutexDevice;
use esp_idf_hal::{
adc::ADC1, use esp_idf_hal::adc::ADC1;
delay::Delay, use esp_idf_hal::i2c::{APBTickType, I2cConfig, I2cDriver};
gpio::{ use esp_idf_hal::units::FromValueType;
Gpio0, Gpio1, Gpio10, Gpio11, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio17, Gpio18, use esp_idf_svc::eventloop::EspSystemEventLoop;
Gpio2, Gpio21, Gpio22, Gpio23, Gpio24, Gpio25, Gpio26, Gpio27, Gpio28, Gpio29, Gpio3, use esp_idf_svc::nvs::EspDefaultNvsPartition;
Gpio30, Gpio4, Gpio5, Gpio6, Gpio7, Gpio8, IOPin, PinDriver, Pull, use esp_idf_svc::wifi::EspWifi;
}, use esp_idf_sys::esp_restart;
i2c::{APBTickType, I2cConfig, I2cDriver},
pcnt::PCNT0,
prelude::Peripherals,
reset::ResetReason,
units::FromValueType,
};
use esp_idf_svc::{eventloop::EspSystemEventLoop, nvs::EspDefaultNvsPartition, wifi::EspWifi};
use esp_idf_sys::{ use esp_idf_sys::{
esp_deep_sleep, esp_restart, esp_sleep_enable_ext1_wakeup, esp_deep_sleep, esp_sleep_enable_ext1_wakeup,
esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW, esp_sleep_ext1_wakeup_mode_t_ESP_EXT1_WAKEUP_ANY_LOW,
}; };
use esp_ota::mark_app_valid;
use measurements::{Current, Voltage};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use anyhow::{Ok, Result};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
use std::result::Result::Ok as OkStd; use std::result::Result::Ok as OkStd;
use std::sync::Mutex; use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use crate::config::{BatteryBoardVersion, BoardVersion, PlantControllerConfig};
use crate::hal::battery::{print_battery_bq34z100, BatteryInteraction, NoBatteryMonitor};
use crate::hal::esp::ESP;
use crate::hal::initial_hal::Initial;
use crate::log::log;
use embedded_hal::digital::OutputPin;
use esp_idf_hal::delay::Delay;
use esp_idf_hal::gpio::{
Gpio0, Gpio1, Gpio10, Gpio11, Gpio12, Gpio13, Gpio14, Gpio15, Gpio16, Gpio17, Gpio18, Gpio2,
Gpio21, Gpio22, Gpio23, Gpio24, Gpio25, Gpio26, Gpio27, Gpio28, Gpio29, Gpio3, Gpio30, Gpio4,
Gpio5, Gpio6, Gpio7, Gpio8, IOPin, PinDriver, Pull,
};
use esp_idf_hal::pcnt::PCNT0;
use esp_idf_hal::prelude::Peripherals;
use esp_idf_hal::reset::ResetReason;
use pca9535::StandardExpanderInterface;
//Only support for 8 right now! //Only support for 8 right now!
pub const PLANT_COUNT: usize = 8; pub const PLANT_COUNT: usize = 8;
const REPEAT_MOIST_MEASURE: usize = 1; const REPEAT_MOIST_MEASURE: usize = 1;
@ -52,6 +60,11 @@ const TANK_MULTI_SAMPLE: usize = 11;
pub static I2C_DRIVER: Lazy<Mutex<I2cDriver<'static>>> = Lazy::new(PlantHal::create_i2c); pub static I2C_DRIVER: Lazy<Mutex<I2cDriver<'static>>> = Lazy::new(PlantHal::create_i2c);
#[non_exhaustive]
struct V3Constants;
impl V3Constants {}
const X25: crc::Crc<u16> = crc::Crc::<u16>::new(&crc::CRC_16_IBM_SDLC); const X25: crc::Crc<u16> = crc::Crc::<u16>::new(&crc::CRC_16_IBM_SDLC);
fn deep_sleep(duration_in_ms: u64) -> ! { fn deep_sleep(duration_in_ms: u64) -> ! {
@ -84,15 +97,25 @@ pub struct HAL<'a> {
pub board_hal: Box<dyn BoardInteraction<'a> + Send>, pub board_hal: Box<dyn BoardInteraction<'a> + Send>,
} }
#[derive(Serialize, Deserialize, PartialEq, Debug, Default)] #[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct BackupHeader { pub struct BackupHeader {
pub timestamp: i64, pub timestamp: i64,
crc16: u16, crc16: u16,
pub size: usize, pub size: usize,
} }
impl Default for BackupHeader {
fn default() -> Self {
Self {
timestamp: Default::default(),
crc16: Default::default(),
size: Default::default(),
}
}
}
pub trait BoardInteraction<'a> { pub trait BoardInteraction<'a> {
fn get_esp(&mut self) -> &mut Esp<'a>; fn get_esp(&mut self) -> &mut ESP<'a>;
fn get_config(&mut self) -> &PlantControllerConfig; fn get_config(&mut self) -> &PlantControllerConfig;
fn get_battery_monitor(&mut self) -> &mut Box<dyn BatteryInteraction + Send>; fn get_battery_monitor(&mut self) -> &mut Box<dyn BatteryInteraction + Send>;
fn set_charge_indicator(&mut self, charging: bool) -> Result<()>; fn set_charge_indicator(&mut self, charging: bool) -> Result<()>;
@ -116,11 +139,8 @@ pub trait BoardInteraction<'a> {
fn test_pump(&mut self, plant: usize) -> Result<()>; fn test_pump(&mut self, plant: usize) -> Result<()>;
fn test(&mut self) -> Result<()>; fn test(&mut self) -> Result<()>;
fn set_config(&mut self, config: PlantControllerConfig) -> Result<()>; fn set_config(&mut self, config: PlantControllerConfig) -> Result<()>;
fn get_mptt_voltage(&mut self) -> anyhow::Result<Voltage>;
fn get_mptt_current(&mut self) -> anyhow::Result<Current>;
} }
#[allow(dead_code)]
pub struct FreePeripherals { pub struct FreePeripherals {
pub gpio0: Gpio0, pub gpio0: Gpio0,
pub gpio1: Gpio1, pub gpio1: Gpio1,
@ -215,7 +235,7 @@ impl PlantHal {
gpio30: peripherals.pins.gpio30, gpio30: peripherals.pins.gpio30,
}; };
let mut esp = Esp { let mut esp = ESP {
mqtt_client: None, mqtt_client: None,
wifi_driver, wifi_driver,
boot_button, boot_button,

View File

@ -1,12 +1,11 @@
use crate::config::PlantControllerConfig;
use crate::hal::battery::BatteryInteraction;
use crate::hal::esp::ESP;
use crate::hal::{ use crate::hal::{
deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor, I2C_DRIVER, PLANT_COUNT, deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor, V3Constants, I2C_DRIVER,
REPEAT_MOIST_MEASURE, TANK_MULTI_SAMPLE, X25, PLANT_COUNT, REPEAT_MOIST_MEASURE, TANK_MULTI_SAMPLE, X25,
}; };
use crate::log::{log, LogMessage}; use crate::log::{log, LogMessage};
use crate::{
config::PlantControllerConfig,
hal::{battery::BatteryInteraction, esp::Esp},
};
use anyhow::{anyhow, bail, Ok, Result}; use anyhow::{anyhow, bail, Ok, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use ds18b20::Ds18b20; use ds18b20::Ds18b20;
@ -14,22 +13,20 @@ use ds323x::{DateTimeAccess, Ds323x};
use eeprom24x::{Eeprom24x, Eeprom24xTrait, SlaveAddr}; use eeprom24x::{Eeprom24x, Eeprom24xTrait, SlaveAddr};
use embedded_hal::digital::OutputPin; use embedded_hal::digital::OutputPin;
use embedded_hal_bus::i2c::MutexDevice; use embedded_hal_bus::i2c::MutexDevice;
use esp_idf_hal::{ use esp_idf_hal::adc::oneshot::config::AdcChannelConfig;
adc::{ use esp_idf_hal::adc::oneshot::{AdcChannelDriver, AdcDriver};
attenuation, use esp_idf_hal::adc::{attenuation, Resolution};
oneshot::{config::AdcChannelConfig, AdcChannelDriver, AdcDriver}, use esp_idf_hal::delay::Delay;
Resolution, use esp_idf_hal::gpio::{AnyInputPin, Gpio5, IOPin, InputOutput, PinDriver, Pull};
}, use esp_idf_hal::i2c::I2cDriver;
delay::Delay, use esp_idf_hal::pcnt::{
gpio::{AnyInputPin, Gpio5, IOPin, InputOutput, PinDriver, Pull}, PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex,
i2c::I2cDriver,
pcnt::{PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex},
}; };
use esp_idf_sys::{gpio_hold_dis, gpio_hold_en, vTaskDelay, EspError}; use esp_idf_sys::{gpio_hold_dis, gpio_hold_en, vTaskDelay, EspError};
use measurements::{Current, Voltage};
use one_wire_bus::OneWire; use one_wire_bus::OneWire;
use plant_ctrl2::sipo::ShiftRegister40; use plant_ctrl2::sipo::ShiftRegister40;
use std::result::Result::Ok as OkStd; use std::result::Result::Ok as OkStd;
use std::sync::Arc;
const PUMP8_BIT: usize = 0; const PUMP8_BIT: usize = 0;
const PUMP1_BIT: usize = 1; const PUMP1_BIT: usize = 1;
@ -79,13 +76,13 @@ const FAULT_2: usize = 23;
pub struct V3<'a> { pub struct V3<'a> {
config: PlantControllerConfig, config: PlantControllerConfig,
battery_monitor: Box<dyn BatteryInteraction + Send>, battery_monitor: Box<dyn BatteryInteraction + Send>,
esp: Esp<'a>, esp: ESP<'a>,
shift_register: ShiftRegister40< shift_register: ShiftRegister40<
PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
>, >,
_shift_register_enable_invert: shift_register_enable_invert:
PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Output>, PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Output>,
tank_channel: AdcChannelDriver<'a, Gpio5, AdcDriver<'a, esp_idf_hal::adc::ADC1>>, tank_channel: AdcChannelDriver<'a, Gpio5, AdcDriver<'a, esp_idf_hal::adc::ADC1>>,
solar_is_day: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>, solar_is_day: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>,
@ -107,10 +104,10 @@ pub struct V3<'a> {
pub(crate) fn create_v3( pub(crate) fn create_v3(
peripherals: FreePeripherals, peripherals: FreePeripherals,
esp: Esp<'static>, esp: ESP<'static>,
config: PlantControllerConfig, config: PlantControllerConfig,
battery_monitor: Box<dyn BatteryInteraction + Send>, battery_monitor: Box<dyn BatteryInteraction + Send>,
) -> Result<Box<dyn BoardInteraction<'static> + Send>> { ) -> Result<Box<dyn BoardInteraction + Send + '_>> {
let mut clock = PinDriver::input_output(peripherals.gpio15.downgrade())?; let mut clock = PinDriver::input_output(peripherals.gpio15.downgrade())?;
clock.set_pull(Pull::Floating)?; clock.set_pull(Pull::Floating)?;
let mut latch = PinDriver::input_output(peripherals.gpio3.downgrade())?; let mut latch = PinDriver::input_output(peripherals.gpio3.downgrade())?;
@ -235,7 +232,7 @@ pub(crate) fn create_v3(
battery_monitor, battery_monitor,
esp, esp,
shift_register, shift_register,
_shift_register_enable_invert: shift_register_enable_invert, shift_register_enable_invert,
tank_channel, tank_channel,
solar_is_day, solar_is_day,
light, light,
@ -250,27 +247,7 @@ pub(crate) fn create_v3(
} }
impl<'a> BoardInteraction<'a> for V3<'a> { impl<'a> BoardInteraction<'a> for V3<'a> {
fn set_charge_indicator(&mut self, charging: bool) -> Result<()> { fn get_esp(&mut self) -> &mut ESP<'a> {
Ok(self.shift_register.decompose()[CHARGING].set_state(charging.into())?)
}
fn is_day(&self) -> bool {
self.solar_is_day.get_level().into()
}
fn get_mptt_voltage(&mut self) -> Result<Voltage> {
//if working this is the hardware set mppt voltage
if self.is_day() {
Ok(Voltage::from_volts(15_f64))
} else {
Ok(Voltage::from_volts(0_f64))
}
}
fn get_mptt_current(&mut self) -> Result<Current> {
bail!("Board does not have current sensor")
}
fn get_esp(&mut self) -> &mut Esp<'a> {
&mut self.esp &mut self.esp
} }
@ -282,6 +259,10 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
&mut self.battery_monitor &mut self.battery_monitor
} }
fn set_charge_indicator(&mut self, charging: bool) -> Result<()> {
Ok(self.shift_register.decompose()[CHARGING].set_state(charging.into())?)
}
fn deep_sleep(&mut self, duration_in_ms: u64) -> ! { fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
let _ = self.shift_register.decompose()[AWAKE].set_low(); let _ = self.shift_register.decompose()[AWAKE].set_low();
deep_sleep(duration_in_ms) deep_sleep(duration_in_ms)
@ -383,6 +364,10 @@ impl<'a> BoardInteraction<'a> for V3<'a> {
Ok(()) Ok(())
} }
fn is_day(&self) -> bool {
self.solar_is_day.get_level().into()
}
fn water_temperature_c(&mut self) -> Result<f32> { fn water_temperature_c(&mut self) -> Result<f32> {
self.one_wire_bus self.one_wire_bus
.reset(&mut self.esp.delay) .reset(&mut self.esp.delay)

View File

@ -1,6 +1,6 @@
use crate::config::PlantControllerConfig; use crate::config::PlantControllerConfig;
use crate::hal::battery::BatteryInteraction; use crate::hal::battery::BatteryInteraction;
use crate::hal::esp::Esp; use crate::hal::esp::ESP;
use crate::hal::{ use crate::hal::{
deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor, I2C_DRIVER, PLANT_COUNT, deep_sleep, BackupHeader, BoardInteraction, FreePeripherals, Sensor, I2C_DRIVER, PLANT_COUNT,
REPEAT_MOIST_MEASURE, TANK_MULTI_SAMPLE, X25, REPEAT_MOIST_MEASURE, TANK_MULTI_SAMPLE, X25,
@ -22,12 +22,10 @@ use esp_idf_hal::i2c::I2cDriver;
use esp_idf_hal::pcnt::{ use esp_idf_hal::pcnt::{
PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex, PcntChannel, PcntChannelConfig, PcntControlMode, PcntCountMode, PcntDriver, PinIndex,
}; };
use esp_idf_sys::{gpio_hold_dis, gpio_hold_en, EspError}; use esp_idf_sys::{gpio_hold_dis, gpio_hold_en, vTaskDelay, EspError};
use ina219::address::{Address, Pin}; use ina219::address::Address;
use ina219::calibration::UnCalibrated; use ina219::calibration::{Calibration, UnCalibrated};
use ina219::configuration::{Configuration, OperatingMode};
use ina219::SyncIna219; use ina219::SyncIna219;
use measurements::{Current, Resistance, Voltage};
use one_wire_bus::OneWire; use one_wire_bus::OneWire;
use pca9535::{GPIOBank, Pca9535Immediate, StandardExpanderInterface}; use pca9535::{GPIOBank, Pca9535Immediate, StandardExpanderInterface};
use std::result::Result::Ok as OkStd; use std::result::Result::Ok as OkStd;
@ -39,82 +37,15 @@ const MS3: u8 = 4_u8;
const MS4: u8 = 2_u8; const MS4: u8 = 2_u8;
const SENSOR_ON: u8 = 5_u8; const SENSOR_ON: u8 = 5_u8;
pub enum Charger<'a> {
SolarMpptV1 {
mppt_ina: SyncIna219<MutexDevice<'a, I2cDriver<'a>>, UnCalibrated>,
solar_is_day: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>,
charge_indicator: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
},
}
impl Charger<'_> {
pub(crate) fn power_save(&mut self) {
match self {
Charger::SolarMpptV1 { mppt_ina, .. } => {
let _ = mppt_ina
.set_configuration(Configuration {
reset: Default::default(),
bus_voltage_range: Default::default(),
shunt_voltage_range: Default::default(),
bus_resolution: Default::default(),
shunt_resolution: Default::default(),
operating_mode: OperatingMode::PowerDown,
})
.map_err(|e| {
println!(
"Error setting ina mppt configuration during deep sleep preparation{:?}",
e
);
});
}
}
}
fn set_charge_indicator(&mut self, charging: bool) -> anyhow::Result<()> {
match self {
Self::SolarMpptV1 {
charge_indicator, ..
} => {
charge_indicator.set_state(charging.into())?;
}
}
Ok(())
}
fn is_day(&self) -> bool {
match self {
Charger::SolarMpptV1 { solar_is_day, .. } => solar_is_day.get_level().into(),
}
}
fn get_mptt_voltage(&mut self) -> anyhow::Result<Voltage> {
let voltage = match self {
Charger::SolarMpptV1 { mppt_ina, .. } => mppt_ina
.bus_voltage()
.map(|v| Voltage::from_millivolts(v.voltage_mv() as f64))?,
};
Ok(voltage)
}
fn get_mptt_current(&mut self) -> anyhow::Result<Current> {
let current = match self {
Charger::SolarMpptV1 { mppt_ina, .. } => mppt_ina.shunt_voltage().map(|v| {
let shunt_voltage = Voltage::from_microvolts(v.shunt_voltage_uv().abs() as f64);
let shut_value = Resistance::from_ohms(0.05_f64);
let current = shunt_voltage.as_volts() / shut_value.as_ohms();
Current::from_amperes(current)
})?,
};
Ok(current)
}
}
pub struct V4<'a> { pub struct V4<'a> {
esp: Esp<'a>, mppt_ina: SyncIna219<MutexDevice<'a, I2cDriver<'a>>, UnCalibrated>,
charger: Charger<'a>, esp: ESP<'a>,
battery_monitor: Box<dyn BatteryInteraction + Send>, battery_monitor: Box<dyn BatteryInteraction + Send>,
config: PlantControllerConfig, config: PlantControllerConfig,
tank_channel: AdcChannelDriver<'a, Gpio5, AdcDriver<'a, esp_idf_hal::adc::ADC1>>, tank_channel: AdcChannelDriver<'a, Gpio5, AdcDriver<'a, esp_idf_hal::adc::ADC1>>,
solar_is_day: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, esp_idf_hal::gpio::Input>,
signal_counter: PcntDriver<'a>, signal_counter: PcntDriver<'a>,
charge_indicator: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
awake: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, Output>, awake: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, Output>,
light: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, light: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
tank_power: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>, tank_power: PinDriver<'a, esp_idf_hal::gpio::AnyIOPin, InputOutput>,
@ -134,14 +65,14 @@ pub struct V4<'a> {
pub(crate) fn create_v4( pub(crate) fn create_v4(
peripherals: FreePeripherals, peripherals: FreePeripherals,
esp: Esp<'static>, esp: ESP<'static>,
config: PlantControllerConfig, config: PlantControllerConfig,
battery_monitor: Box<dyn BatteryInteraction + Send>, battery_monitor: Box<dyn BatteryInteraction + Send>,
) -> anyhow::Result<Box<dyn BoardInteraction<'static> + Send + 'static>> { ) -> anyhow::Result<Box<dyn BoardInteraction + Send + '_>> {
let mut awake = PinDriver::output(peripherals.gpio21.downgrade())?; let mut awake = PinDriver::output(peripherals.gpio15.downgrade())?;
awake.set_high()?; awake.set_high()?;
let mut general_fault = PinDriver::input_output(peripherals.gpio23.downgrade())?; let mut general_fault = PinDriver::input_output(peripherals.gpio6.downgrade())?;
general_fault.set_pull(Pull::Floating)?; general_fault.set_pull(Pull::Floating)?;
general_fault.set_low()?; general_fault.set_low()?;
@ -156,12 +87,6 @@ pub(crate) fn create_v4(
) )
}; };
let mut extra1 = PinDriver::output(peripherals.gpio6.downgrade())?;
extra1.set_high()?;
let mut extra2 = PinDriver::output(peripherals.gpio15.downgrade())?;
extra1.set_high()?;
let mut one_wire_pin = PinDriver::input_output_od(peripherals.gpio18.downgrade())?; let mut one_wire_pin = PinDriver::input_output_od(peripherals.gpio18.downgrade())?;
one_wire_pin.set_pull(Pull::Floating)?; one_wire_pin.set_pull(Pull::Floating)?;
@ -248,21 +173,7 @@ pub(crate) fn create_v4(
let _ = sensor_expander.pin_set_low(GPIOBank::Bank1, pin); let _ = sensor_expander.pin_set_low(GPIOBank::Bank1, pin);
} }
//TODO error handling is not done nicely here, should not break if ina is not responsive let mut mppt_ina = SyncIna219::new(MutexDevice::new(&I2C_DRIVER), Address::from_byte(68)?)?;
let mut mppt_ina = SyncIna219::new(
MutexDevice::new(&I2C_DRIVER),
Address::from_pins(Pin::Vcc, Pin::Gnd),
)?;
mppt_ina.set_configuration(Configuration {
reset: Default::default(),
bus_voltage_range: Default::default(),
shunt_voltage_range: Default::default(),
bus_resolution: Default::default(),
shunt_resolution: ina219::configuration::Resolution::Avg128,
operating_mode: Default::default(),
})?;
//TODO this is probably already done until we are ready first time?, maybe add startup time comparison on access?
esp.delay.delay_ms( esp.delay.delay_ms(
mppt_ina mppt_ina
.configuration()? .configuration()?
@ -270,17 +181,18 @@ pub(crate) fn create_v4(
.unwrap() .unwrap()
.as_millis() as u32, .as_millis() as u32,
); );
println!("Bus Voltage: {}", mppt_ina.bus_voltage()?);
let charger = Charger::SolarMpptV1 { println!("Shunt Voltage: {}", mppt_ina.shunt_voltage()?);
mppt_ina, let volt = (mppt_ina.shunt_voltage()?.shunt_voltage_mv()) as f32 / 1000_f32;
solar_is_day, let current = volt / 0.05;
charge_indicator, println!("Shunt Current: {}", current);
};
let v = V4 { let v = V4 {
mppt_ina,
esp, esp,
awake, awake,
tank_channel, tank_channel,
solar_is_day,
signal_counter, signal_counter,
light, light,
tank_power, tank_power,
@ -290,15 +202,15 @@ pub(crate) fn create_v4(
general_fault, general_fault,
pump_expander, pump_expander,
sensor_expander, sensor_expander,
charge_indicator,
config, config,
battery_monitor, battery_monitor,
charger,
}; };
Ok(Box::new(v)) Ok(Box::new(v))
} }
impl<'a> BoardInteraction<'a> for V4<'a> { impl<'a> BoardInteraction<'a> for V4<'a> {
fn get_esp(&mut self) -> &mut Esp<'a> { fn get_esp(&mut self) -> &mut ESP<'a> {
&mut self.esp &mut self.esp
} }
@ -311,12 +223,14 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
} }
fn set_charge_indicator(&mut self, charging: bool) -> anyhow::Result<()> { fn set_charge_indicator(&mut self, charging: bool) -> anyhow::Result<()> {
self.charger.set_charge_indicator(charging) self.charge_indicator
.set_state(charging.into())
.expect("cannot fail");
Ok(())
} }
fn deep_sleep(&mut self, duration_in_ms: u64) -> ! { fn deep_sleep(&mut self, duration_in_ms: u64) -> ! {
self.awake.set_low().unwrap(); self.awake.set_low().unwrap();
self.charger.power_save();
deep_sleep(duration_in_ms); deep_sleep(duration_in_ms);
} }
@ -417,7 +331,7 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
} }
fn is_day(&self) -> bool { fn is_day(&self) -> bool {
self.charger.is_day() self.solar_is_day.get_level().into()
} }
fn water_temperature_c(&mut self) -> anyhow::Result<f32> { fn water_temperature_c(&mut self) -> anyhow::Result<f32> {
@ -654,12 +568,4 @@ impl<'a> BoardInteraction<'a> for V4<'a> {
self.esp.save_config(&self.config)?; self.esp.save_config(&self.config)?;
anyhow::Ok(()) anyhow::Ok(())
} }
fn get_mptt_voltage(&mut self) -> anyhow::Result<Voltage> {
self.charger.get_mptt_voltage()
}
fn get_mptt_current(&mut self) -> anyhow::Result<Current> {
self.charger.get_mptt_current()
}
} }

View File

@ -65,7 +65,7 @@ pub fn get_log() -> Vec<LogEntry> {
read_copy.push(copy); read_copy.push(copy);
} }
drop(buffer); drop(buffer);
read_copy return read_copy;
} }
pub fn log(message_key: LogMessage, number_a: u32, number_b: u32, txt_short: &str, txt_long: &str) { pub fn log(message_key: LogMessage, number_a: u32, number_b: u32, txt_short: &str, txt_long: &str) {

View File

@ -1,39 +1,43 @@
use crate::{ use crate::webserver::webserver::httpd;
config::BoardVersion::INITIAL,
hal::{PlantHal, HAL, PLANT_COUNT},
webserver::httpd,
};
use anyhow::bail; use anyhow::bail;
use chrono::{DateTime, Datelike, Timelike, Utc}; use chrono::{DateTime, Datelike, Timelike, Utc};
use chrono_tz::Tz::{self, UTC}; use chrono_tz::Tz;
use chrono_tz::Tz::UTC;
use esp_idf_hal::delay::Delay; use esp_idf_hal::delay::Delay;
use esp_idf_sys::{ use esp_idf_sys::{
esp_ota_get_app_partition_count, esp_ota_get_running_partition, esp_ota_get_state_partition, esp_ota_get_app_partition_count, esp_ota_get_running_partition, esp_ota_get_state_partition,
esp_ota_img_states_t, esp_ota_img_states_t_ESP_OTA_IMG_ABORTED, esp_ota_img_states_t, esp_ota_img_states_t_ESP_OTA_IMG_ABORTED,
esp_ota_img_states_t_ESP_OTA_IMG_INVALID, esp_ota_img_states_t_ESP_OTA_IMG_NEW, esp_ota_img_states_t_ESP_OTA_IMG_INVALID, esp_ota_img_states_t_ESP_OTA_IMG_NEW,
esp_ota_img_states_t_ESP_OTA_IMG_PENDING_VERIFY, esp_ota_img_states_t_ESP_OTA_IMG_UNDEFINED, esp_ota_img_states_t_ESP_OTA_IMG_PENDING_VERIFY, esp_ota_img_states_t_ESP_OTA_IMG_UNDEFINED,
esp_ota_img_states_t_ESP_OTA_IMG_VALID, esp_ota_img_states_t_ESP_OTA_IMG_VALID, vTaskDelay,
}; };
use esp_ota::{mark_app_valid, rollback_and_reboot}; use esp_ota::{mark_app_valid, rollback_and_reboot};
use hal::battery::BatteryState; use hal::battery::BatteryState;
use log::{log, LogMessage}; use log::{log, LogMessage};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use plant_state::PlantState;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::{atomic::AtomicBool, Arc, Mutex, MutexGuard}; use std::sync::MutexGuard;
use tank::*; use std::{
fmt::Display,
sync::{atomic::AtomicBool, Arc, Mutex},
};
mod config; mod config;
mod hal; mod hal;
mod log; mod log;
mod plant_state; mod plant_state;
mod tank; mod tank;
mod webserver;
use crate::config::BoardVersion::INITIAL;
use crate::hal::battery::BatteryInteraction;
use crate::hal::{BoardInteraction, PlantHal, HAL, PLANT_COUNT};
use plant_state::PlantState;
use tank::*;
pub static BOARD_ACCESS: Lazy<Mutex<HAL>> = Lazy::new(|| PlantHal::create().unwrap()); pub static BOARD_ACCESS: Lazy<Mutex<HAL>> = Lazy::new(|| PlantHal::create().unwrap());
pub static STAY_ALIVE: Lazy<AtomicBool> = Lazy::new(|| AtomicBool::new(false)); pub static STAY_ALIVE: Lazy<AtomicBool> = Lazy::new(|| AtomicBool::new(false));
mod webserver {
pub mod webserver;
}
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
enum WaitType { enum WaitType {
@ -68,7 +72,7 @@ struct LightState {
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, Default)] #[derive(Serialize, Deserialize, Debug, PartialEq, Default)]
///mqtt struct to track pump activities ///mqtt stuct to track pump activities
struct PumpInfo { struct PumpInfo {
enabled: bool, enabled: bool,
pump_ineffective: bool, pump_ineffective: bool,
@ -174,7 +178,16 @@ fn safe_main() -> anyhow::Result<()> {
} }
println!("cur is {}", cur); println!("cur is {}", cur);
update_charge_indicator(&mut board); match board
.board_hal
.get_battery_monitor()
.average_current_milli_ampere()
{
Ok(charging) => {
let _ = board.board_hal.set_charge_indicator(charging > 20);
}
Err(_) => {}
}
if board.board_hal.get_esp().get_restart_to_conf() { if board.board_hal.get_esp().get_restart_to_conf() {
log(LogMessage::ConfigModeSoftwareOverride, 0, 0, "", ""); log(LogMessage::ConfigModeSoftwareOverride, 0, 0, "", "");
@ -255,7 +268,7 @@ fn safe_main() -> anyhow::Result<()> {
address, address,
ota_state_string, ota_state_string,
&mut board, &mut board,
ip_address, &ip_address,
timezone_time, timezone_time,
); );
publish_battery_state(&mut board); publish_battery_state(&mut board);
@ -411,12 +424,12 @@ fn safe_main() -> anyhow::Result<()> {
.state_charge_percent() .state_charge_percent()
.unwrap_or(0.); .unwrap_or(0.);
// try to load full battery state if failed the battery state is unknown /// try to load full battery state if failed the battery state is unknown
let battery_state = board let battery_state = board
.board_hal .board_hal
.get_battery_monitor() .get_battery_monitor()
.get_battery_state() .get_battery_state()
.unwrap_or(BatteryState::Unknown); .unwrap_or(hal::battery::BatteryState::Unknown);
let mut light_state = LightState { let mut light_state = LightState {
enabled: board.board_hal.get_config().night_lamp.enabled, enabled: board.board_hal.get_config().night_lamp.enabled,
@ -546,26 +559,6 @@ fn safe_main() -> anyhow::Result<()> {
.deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64); .deep_sleep(1000 * 1000 * 60 * deep_sleep_duration_minutes as u64);
} }
fn update_charge_indicator(board: &mut MutexGuard<HAL>) {
//we have mppt controller, ask it for charging current
if let Ok(current) = board.board_hal.get_mptt_current() {
let _ = board
.board_hal
.set_charge_indicator(current.as_milliamperes() > 20_f64);
}
//fallback to battery controller and ask it instead
else if let Ok(charging) = board
.board_hal
.get_battery_monitor()
.average_current_milli_ampere()
{
let _ = board.board_hal.set_charge_indicator(charging > 20);
} else {
//who knows
let _ = board.board_hal.set_charge_indicator(false);
}
}
fn obtain_tank_temperature(board: &mut MutexGuard<HAL>) -> anyhow::Result<f32> { fn obtain_tank_temperature(board: &mut MutexGuard<HAL>) -> anyhow::Result<f32> {
//multisample should be moved to water_temperature_c //multisample should be moved to water_temperature_c
let mut attempt = 1; let mut attempt = 1;
@ -618,7 +611,7 @@ fn publish_plant_states(
.zip(&board.board_hal.get_config().plants.clone()) .zip(&board.board_hal.get_config().plants.clone())
.enumerate() .enumerate()
{ {
match serde_json::to_string(&plant_state.to_mqtt_info(plant_conf, timezone_time)) { match serde_json::to_string(&plant_state.to_mqtt_info(plant_conf, &timezone_time)) {
Ok(state) => { Ok(state) => {
let plant_topic = format!("/plant{}", plant_id + 1); let plant_topic = format!("/plant{}", plant_id + 1);
let _ = board let _ = board
@ -689,7 +682,7 @@ fn try_connect_wifi_sntp_mqtt(board: &mut MutexGuard<HAL>) -> NetworkMode {
SntpMode::OFFLINE SntpMode::OFFLINE
} }
}; };
let mqtt_connected = if board.board_hal.get_config().network.mqtt_url.is_some() { let mqtt_connected = if let Some(_) = board.board_hal.get_config().network.mqtt_url {
let nw_config = &board.board_hal.get_config().network.clone(); let nw_config = &board.board_hal.get_config().network.clone();
match board.board_hal.get_esp().mqtt(nw_config) { match board.board_hal.get_esp().mqtt(nw_config) {
Ok(_) => { Ok(_) => {
@ -746,8 +739,7 @@ fn pump_info(
fn publish_battery_state(board: &mut MutexGuard<'_, HAL<'_>>) { fn publish_battery_state(board: &mut MutexGuard<'_, HAL<'_>>) {
let state = board.board_hal.get_battery_monitor().get_battery_state(); let state = board.board_hal.get_battery_monitor().get_battery_state();
if let Ok(serialized_battery_state_bytes) = if let Ok(serialized_battery_state_bytes) = serde_json::to_string(&state).map(|s| s.into_bytes())
serde_json::to_string(&state).map(|s| s.into_bytes())
{ {
let _ = board let _ = board
.board_hal .board_hal
@ -760,11 +752,17 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
let delay = wait_type.blink_pattern(); let delay = wait_type.blink_pattern();
let mut led_count = 8; let mut led_count = 8;
let mut pattern_step = 0; let mut pattern_step = 0;
let delay_handle = Delay::new_default();
loop {
let mut board = BOARD_ACCESS.lock().unwrap();
update_charge_indicator(&mut board);
loop {
unsafe {
let mut board = BOARD_ACCESS.lock().unwrap();
if let Ok(charging) = board
.board_hal
.get_battery_monitor()
.average_current_milli_ampere()
{
let _ = board.board_hal.set_charge_indicator(charging > 20);
}
match wait_type { match wait_type {
WaitType::MissingConfig => { WaitType::MissingConfig => {
// Keep existing behavior: circular filling pattern // Keep existing behavior: circular filling pattern
@ -792,8 +790,7 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
board.board_hal.general_fault(true); board.board_hal.general_fault(true);
drop(board); drop(board);
//cannot use shared delay as that is inside the mutex here vTaskDelay(delay);
delay_handle.delay_ms(delay);
let mut board = BOARD_ACCESS.lock().unwrap(); let mut board = BOARD_ACCESS.lock().unwrap();
board.board_hal.general_fault(false); board.board_hal.general_fault(false);
@ -802,7 +799,7 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
let _ = board.board_hal.fault(i, false); let _ = board.board_hal.fault(i, false);
} }
drop(board); drop(board);
delay_handle.delay_ms(delay); vTaskDelay(delay);
if wait_type == WaitType::MqttConfig if wait_type == WaitType::MqttConfig
&& !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed) && !STAY_ALIVE.load(std::sync::atomic::Ordering::Relaxed)
@ -816,11 +813,12 @@ fn wait_infinity(wait_type: WaitType, reboot_now: Arc<AtomicBool>) -> ! {
} }
} }
} }
}
fn main() { fn main() {
let result = safe_main(); let result = safe_main();
match result { match result {
// this should not get triggered, safe_main should not return but go into deep sleep with sensible // this should not get triggered, safe_main should not return but go into deep sleep with sensbile
// timeout, this is just a fallback // timeout, this is just a fallback
Ok(_) => { Ok(_) => {
println!("Main app finished, restarting"); println!("Main app finished, restarting");
@ -841,14 +839,23 @@ fn main() {
} }
} }
fn to_string<T: Display>(value: anyhow::Result<T>) -> String {
match value {
Ok(v) => v.to_string(),
Err(err) => {
format!("{:?}", err)
}
}
}
pub fn in_time_range(cur: &DateTime<Tz>, start: u8, end: u8) -> bool { pub fn in_time_range(cur: &DateTime<Tz>, start: u8, end: u8) -> bool {
let current_hour = cur.hour() as u8; let curhour = cur.hour() as u8;
//eg 10-14 //eg 10-14
if start < end { if start < end {
current_hour > start && current_hour < end curhour > start && curhour < end
} else { } else {
//eg 20-05 //eg 20-05
current_hour > start || current_hour < end curhour > start || curhour < end
} }
} }

View File

@ -1,12 +1,10 @@
use crate::{
config::PlantConfig,
hal::{Sensor, HAL},
in_time_range,
};
use chrono::{DateTime, TimeDelta, Utc}; use chrono::{DateTime, TimeDelta, Utc};
use chrono_tz::Tz; use chrono_tz::Tz;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::hal::{BoardInteraction, Sensor, HAL};
use crate::{config::PlantConfig, in_time_range};
const MOIST_SENSOR_MAX_FREQUENCY: f32 = 7500.; // 60kHz (500Hz margin) const MOIST_SENSOR_MAX_FREQUENCY: f32 = 7500.; // 60kHz (500Hz margin)
const MOIST_SENSOR_MIN_FREQUENCY: f32 = 150.; // this is really, really dry, think like cactus levels const MOIST_SENSOR_MIN_FREQUENCY: f32 = 150.; // this is really, really dry, think like cactus levels
@ -239,11 +237,7 @@ impl PlantState {
} }
} }
pub fn to_mqtt_info( pub fn to_mqtt_info(&self, plant_conf: &PlantConfig, current_time: &DateTime<Tz>) -> PlantInfo {
&self,
plant_conf: &PlantConfig,
current_time: &DateTime<Tz>,
) -> PlantInfo<'_> {
PlantInfo { PlantInfo {
sensor_a: &self.sensor_a, sensor_a: &self.sensor_a,
sensor_b: &self.sensor_b, sensor_b: &self.sensor_b,

View File

@ -100,7 +100,7 @@ macro_rules! ShiftRegisterBuilder {
} }
/// Get embedded-hal output pins to control the shift register outputs /// Get embedded-hal output pins to control the shift register outputs
pub fn decompose(&self) -> [ShiftRegisterPin<'_>; $size] { pub fn decompose(&self) -> [ShiftRegisterPin; $size] {
// Create an uninitialized array of `MaybeUninit`. The `assume_init` is // Create an uninitialized array of `MaybeUninit`. The `assume_init` is
// safe because the type we are claiming to have initialized here is a // safe because the type we are claiming to have initialized here is a
// bunch of `MaybeUninit`s, which do not require initialization. // bunch of `MaybeUninit`s, which do not require initialization.

View File

@ -1,6 +1,8 @@
use crate::{config::TankConfig, hal::HAL};
use serde::Serialize; use serde::Serialize;
use crate::config::TankConfig;
use crate::hal::{BoardInteraction, HAL};
const OPEN_TANK_VOLTAGE: f32 = 3.0; const OPEN_TANK_VOLTAGE: f32 = 3.0;
pub const WATER_FROZEN_THRESH: f32 = 4.0; pub const WATER_FROZEN_THRESH: f32 = 4.0;

View File

@ -1,12 +1,8 @@
//offer ota and config mode //offer ota and config mode
use crate::hal::battery::BatteryInteraction;
use crate::{ use crate::{
config::PlantControllerConfig, determine_tank_state, get_version, log::LogMessage, plant_state::PlantState, BOARD_ACCESS,
determine_tank_state, get_version,
hal::PLANT_COUNT,
log::LogMessage,
plant_state::{MoistureSensorState, PlantState},
BOARD_ACCESS,
}; };
use anyhow::bail; use anyhow::bail;
use chrono::DateTime; use chrono::DateTime;
@ -23,6 +19,10 @@ use std::{
}; };
use url::Url; use url::Url;
use crate::config::PlantControllerConfig;
use crate::hal::{BoardInteraction, PLANT_COUNT};
use crate::plant_state::MoistureSensorState;
#[derive(Serialize, Debug)] #[derive(Serialize, Debug)]
struct SSIDList<'a> { struct SSIDList<'a> {
ssids: Vec<&'a String<32>>, ssids: Vec<&'a String<32>>,
@ -40,13 +40,6 @@ struct Moistures {
moisture_b: Vec<std::string::String>, moisture_b: Vec<std::string::String>,
} }
#[derive(Serialize, Debug)]
struct SolarState {
mppt_voltage: f32,
mppt_current: f32,
is_day: bool,
}
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
struct SetTime<'a> { struct SetTime<'a> {
time: &'a str, time: &'a str,
@ -221,22 +214,10 @@ fn set_config(
let config: PlantControllerConfig = serde_json::from_slice(&all)?; let config: PlantControllerConfig = serde_json::from_slice(&all)?;
let mut board = BOARD_ACCESS.lock().expect("board access"); let mut board = BOARD_ACCESS.lock().expect("board access");
board.board_hal.set_config(config)?; board.board_hal.set_config(config);
anyhow::Ok(Some("saved".to_owned())) anyhow::Ok(Some("saved".to_owned()))
} }
fn get_solar_state(
_request: &mut Request<&mut EspHttpConnection>,
) -> Result<Option<std::string::String>, anyhow::Error> {
let mut board = BOARD_ACCESS.lock().expect("board access");
let state = SolarState {
mppt_voltage: board.board_hal.get_mptt_voltage()?.as_volts() as f32,
mppt_current: board.board_hal.get_mptt_current()?.as_amperes() as f32,
is_day: board.board_hal.is_day(),
};
anyhow::Ok(Some(serde_json::to_string(&state)?))
}
fn get_battery_state( fn get_battery_state(
_request: &mut Request<&mut EspHttpConnection>, _request: &mut Request<&mut EspHttpConnection>,
) -> Result<Option<std::string::String>, anyhow::Error> { ) -> Result<Option<std::string::String>, anyhow::Error> {
@ -341,7 +322,6 @@ fn ota(
let iter = (total_read / 1024) % 8; let iter = (total_read / 1024) % 8;
if iter != lastiter { if iter != lastiter {
board.board_hal.general_fault(iter%5==0);
for i in 0..PLANT_COUNT { for i in 0..PLANT_COUNT {
let _ = board.board_hal.fault(i, iter == i); let _ = board.board_hal.fault(i, iter == i);
} }
@ -403,11 +383,6 @@ pub fn httpd(reboot_now: Arc<AtomicBool>) -> Box<EspHttpServer<'static>> {
handle_error_to500(request, get_battery_state) handle_error_to500(request, get_battery_state)
}) })
.unwrap(); .unwrap();
server
.fn_handler("/solar", Method::Get, |request| {
handle_error_to500(request, get_solar_state)
})
.unwrap();
server server
.fn_handler("/time", Method::Get, |request| { .fn_handler("/time", Method::Get, |request| {
handle_error_to500(request, get_time) handle_error_to500(request, get_time)

View File

@ -38,12 +38,6 @@ export interface FileList {
iter_error: string, iter_error: string,
} }
export interface SolarState{
mppt_voltage: number,
mppt_current: number,
is_day: boolean
}
export interface FileInfo{ export interface FileInfo{
filename: string, filename: string,
size: number, size: number,

View File

@ -13,7 +13,7 @@
<select class="boardvalue" id="hardware_board_value"> <select class="boardvalue" id="hardware_board_value">
</select> </select>
</div> </div>
<div class="flexcontainer"> <div class="flexcontainer" style="text-decoration-line: line-through;">
<div class="boardkey">BatteryMonitor</div> <div class="boardkey">BatteryMonitor</div>
<select class="boardvalue" id="hardware_battery_value"> <select class="boardvalue" id="hardware_battery_value">
</select> </select>

View File

@ -149,8 +149,6 @@
</div> </div>
<div id="batteryview" class="subcontainer"> <div id="batteryview" class="subcontainer">
</div> </div>
<div id="solarview" class="subcontainer">
</div>
</div> </div>
<div class="flexcontainer"> <div class="flexcontainer">

View File

@ -28,9 +28,8 @@ import {
SetTime, SSIDList, TankInfo, SetTime, SSIDList, TankInfo,
TestPump, TestPump,
VersionInfo, VersionInfo,
FileList, SolarState FileList
} from "./api"; } from "./api";
import {SolarView} from "./solarview";
export class Controller { export class Controller {
loadTankInfo() : Promise<void> { loadTankInfo() : Promise<void> {
@ -161,7 +160,7 @@ export class Controller {
console.log(error); console.log(error);
}); });
} }
updateBatteryData() { updateBatteryData(): Promise<void> {
return fetch(PUBLIC_URL + "/battery") return fetch(PUBLIC_URL + "/battery")
.then(response => response.json()) .then(response => response.json())
.then(json => json as BatteryState) .then(json => json as BatteryState)
@ -173,18 +172,6 @@ export class Controller {
console.log(error); console.log(error);
}) })
} }
updateSolarData() {
return fetch(PUBLIC_URL + "/solar")
.then(response => response.json())
.then(json => json as SolarState)
.then(solar => {
controller.solarView.update(solar)
})
.catch(error => {
controller.solarView.update(null)
console.log(error);
})
}
uploadNewFirmware(file: File) { uploadNewFirmware(file: File) {
var current = 0; var current = 0;
var max = 100; var max = 100;
@ -257,7 +244,6 @@ export class Controller {
//load from remote to be clean //load from remote to be clean
controller.downloadConfig() controller.downloadConfig()
} }
backupConfig(json: string, statusCallback: (status: string) => void) { backupConfig(json: string, statusCallback: (status: string) => void) {
controller.progressview.addIndeterminate("backup_config", "Backingup Config") controller.progressview.addIndeterminate("backup_config", "Backingup Config")
fetch(PUBLIC_URL + "/backup_config", { fetch(PUBLIC_URL + "/backup_config", {
@ -479,7 +465,6 @@ export class Controller {
readonly firmWareView: OTAView; readonly firmWareView: OTAView;
readonly progressview: ProgressView; readonly progressview: ProgressView;
readonly batteryView: BatteryView; readonly batteryView: BatteryView;
readonly solarView: SolarView;
readonly fileview: FileView; readonly fileview: FileView;
readonly logView: LogView readonly logView: LogView
constructor() { constructor() {
@ -488,7 +473,6 @@ export class Controller {
this.networkView = new NetworkConfigView(this, PUBLIC_URL) this.networkView = new NetworkConfigView(this, PUBLIC_URL)
this.tankView = new TankConfigView(this) this.tankView = new TankConfigView(this)
this.batteryView = new BatteryView(this) this.batteryView = new BatteryView(this)
this.solarView = new SolarView(this)
this.nightLampView = new NightLampView(this) this.nightLampView = new NightLampView(this)
this.submitView = new SubmitView(this) this.submitView = new SubmitView(this)
this.firmWareView = new OTAView(this) this.firmWareView = new OTAView(this)
@ -505,16 +489,21 @@ export class Controller {
controller.exit(); controller.exit();
} }
} }
selftest() {
}
} }
const controller = new Controller(); const controller = new Controller();
controller.progressview.removeProgress("rebooting"); controller.progressview.removeProgress("rebooting");
const tasks = [ const tasks = [
{ task: controller.populateTimezones, displayString: "Populating Timezones" }, { task: controller.populateTimezones, displayString: "Populating Timezones" },
{ task: controller.updateRTCData, displayString: "Updating RTC Data" }, { task: controller.updateRTCData, displayString: "Updating RTC Data" },
{ task: controller.updateBatteryData, displayString: "Updating Battery Data" }, { task: controller.updateBatteryData, displayString: "Updating Battery Data" },
{ task: controller.updateSolarData, displayString: "Updating Solar Data" },
{ task: controller.downloadConfig, displayString: "Downloading Configuration" }, { task: controller.downloadConfig, displayString: "Downloading Configuration" },
{ task: controller.version, displayString: "Fetching Version Information" }, { task: controller.version, displayString: "Fetching Version Information" },
{ task: controller.updateFileList, displayString: "Updating File List" }, { task: controller.updateFileList, displayString: "Updating File List" },

View File

@ -20,7 +20,7 @@
<div class="lightkey">Test Nightlight</div> <div class="lightkey">Test Nightlight</div>
<input class="lightcheckbox" type="checkbox" id="night_lamp_test"> <input class="lightcheckbox" type="checkbox" id="night_lamp_test">
</div> </div>
<div class="flexcontainer"> <div class="flexcontainer" style="text-decoration-line: line-through;">
<div class="lightkey">Enable Nightlight</div> <div class="lightkey">Enable Nightlight</div>
<input class="lightcheckbox" type="checkbox" id="night_lamp_enabled"> <input class="lightcheckbox" type="checkbox" id="night_lamp_enabled">
</div> </div>

View File

@ -29,7 +29,7 @@ export class OTAView {
}; };
test.onclick = () => { test.onclick = () => {
controller.selfTest(); controller.selftest();
} }
} }

View File

@ -1,29 +0,0 @@
<style>
.solarflexkey {
min-width: 150px;
}
.solarflexvalue {
text-wrap: nowrap;
flex-grow: 1;
}
</style>
<div class="flexcontainer">
<div class="subtitle">
Mppt:
</div>
<input id="solar_auto_refresh" type="checkbox">
</div>
<div class="flexcontainer">
<span class="solarflexkey">Mppt mV:</span>
<span class="solarflexvalue" id="solar_voltage_milli_volt"></span>
</div>
<div class="flexcontainer">
<span class="solarflexkey">Mppt mA:</span>
<span class="solarflexvalue" id="solar_current_milli_ampere" ></span>
</div>
<div class="flexcontainer">
<span class="solarflexkey">is Day:</span>
<span class="solarflexvalue" id="solar_is_day" ></span>
</div>

View File

@ -1,49 +0,0 @@
import { Controller } from "./main";
import {BatteryState, SolarState} from "./api";
export class SolarView{
solar_voltage_milli_volt: HTMLSpanElement;
solar_current_milli_ampere: HTMLSpanElement;
solar_is_day: HTMLSpanElement;
solar_auto_refresh: HTMLInputElement;
timer: NodeJS.Timeout | undefined;
controller: Controller;
constructor (controller:Controller) {
(document.getElementById("solarview") as HTMLElement).innerHTML = require("./solarview.html")
this.solar_voltage_milli_volt = document.getElementById("solar_voltage_milli_volt") as HTMLSpanElement;
this.solar_current_milli_ampere = document.getElementById("solar_current_milli_ampere") as HTMLSpanElement;
this.solar_is_day = document.getElementById("solar_is_day") as HTMLSpanElement;
this.solar_auto_refresh = document.getElementById("solar_auto_refresh") as HTMLInputElement;
this.controller = controller
this.solar_auto_refresh.onchange = () => {
if(this.timer){
clearTimeout(this.timer)
}
if(this.solar_auto_refresh.checked){
controller.updateSolarData()
}
}
}
update(solarState: SolarState|null){
if (solarState == null) {
this.solar_voltage_milli_volt.innerText = "N/A"
this.solar_current_milli_ampere.innerText = "N/A"
this.solar_is_day.innerText = "N/A"
} else {
this.solar_voltage_milli_volt.innerText = solarState.mppt_voltage.toFixed(2)
this.solar_current_milli_ampere.innerText = String(+solarState.mppt_current)
this.solar_is_day.innerText = solarState.is_day?"🌞":"🌙"
}
if(this.solar_auto_refresh.checked){
this.timer = setTimeout(this.controller.updateSolarData, 1000);
} else {
if(this.timer){
clearTimeout(this.timer)
}
}
}
}

View File

@ -7,31 +7,14 @@
word-wrap: break-word; word-wrap: break-word;
overflow: scroll; overflow: scroll;
} }
.submitbutton{
padding: 1em 1em;
background: #667eea;
color: white;
border: none;
border-radius: 8px;
font-size: 1.1em;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
letter-spacing: 1px;
margin: 1em 0;
}
.submitbutton:hover {
background: #1c4e63;
}
</style> </style>
<button class="submitbutton" id="submit">Submit</button>
<br>
<button id="showJson">Show Json</button> <button id="showJson">Show Json</button>
<div id="rawdata" class="flexcontainer" style="display: none;"> <div id="rawdata" class="flexcontainer" style="display: none;">
<div class="submitarea" id="json" contenteditable="true"></div> <div class="submitarea" id="json" contenteditable="true"></div>
<div class="submitarea" id="backupjson">backup will be here</div> <div class="submitarea" id="backupjson">backup will be here</div>
</div> </div>
<button id="submit">Submit</button>
<div>BackupStatus:</div> <div>BackupStatus:</div>
<div id="backuptimestamp"></div> <div id="backuptimestamp"></div>
<div id="backupsize"></div> <div id="backupsize"></div>

View File

@ -9,7 +9,7 @@ console.log("Dev server is " + isDevServer);
var host; var host;
if (isDevServer){ if (isDevServer){
//ensure no trailing / //ensure no trailing /
host = 'http://10.23.44.186'; host = 'http://192.168.71.1';
} else { } else {
host = ''; host = '';
} }
@ -49,7 +49,7 @@ module.exports = {
}, },
output: { output: {
filename: 'bundle.js', filename: 'bundle.js',
path: path.resolve(__dirname, '.'), path: path.resolve(__dirname, '../src/webserver'),
}, },
devServer: { devServer: {
} }