diff --git a/Cargo.lock b/Cargo.lock index 17da480..52de12f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,7 +52,7 @@ checksum = "331afbb18ce7b644c0b428726d369c5dd37ca0b815d72a459fcc2896c3c8ad32" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -63,7 +63,7 @@ checksum = "f48d6ace212fdf1b45fd6b566bb40808415344642b76c3224c07c8df9da81e97" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -168,6 +168,16 @@ dependencies = [ "darling_macro 0.21.3", ] +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", +] + [[package]] name = "darling_core" version = "0.20.11" @@ -179,7 +189,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -192,7 +202,20 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", ] [[package]] @@ -203,7 +226,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -214,7 +237,18 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.112", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core 0.23.0", + "quote", + "syn 2.0.114", ] [[package]] @@ -246,7 +280,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -266,7 +300,7 @@ checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -333,7 +367,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -351,7 +385,7 @@ checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" [[package]] name = "embassy-ha" version = "0.2.0" -source = "git+https://github.com/ToBinio/embassy-ha#5cc7223d4c1e80bfc97d73a2a3b87fb962c577cf" +source = "git+https://github.com/ToBinio/embassy-ha#5839f1f22df8c6bd4d41a63fca1fc005d045e3c1" dependencies = [ "embassy-futures", "embassy-net", @@ -576,7 +610,7 @@ dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -714,7 +748,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", "termcolor", ] @@ -1051,9 +1085,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown", @@ -1070,15 +1104,15 @@ dependencies = [ [[package]] name = "instability" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6778b0196eefee7df739db78758e5cf9b37412268bfa5650bfeed028aed20d9c" +checksum = "357b7205c6cd18dd2c86ed312d1e70add149aea98e7ef72b9fdf0270e555c11d" dependencies = [ - "darling 0.20.11", + "darling 0.23.0", "indoc", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1089,9 +1123,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a87d9b8105c23642f50cbbae03d1f75d8422c5cb98ce7ee9271f7ff7505be6b8" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" dependencies = [ "jiff-static", "log", @@ -1102,13 +1136,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b787bebb543f8969132630c51fd0afab173a86c6abae56ff3b9e5e3e3f9f6e58" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1125,9 +1159,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.178" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "linked_list_allocator" @@ -1182,7 +1216,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1245,7 +1279,7 @@ checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1276,23 +1310,23 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] name = "proc-macro2" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" dependencies = [ "proc-macro2", ] @@ -1330,7 +1364,7 @@ checksum = "7d323d13972c1b104aa036bc692cd08b822c8bbf23d79a27c526095856499799" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1359,7 +1393,7 @@ checksum = "def519ddeeb5e43c2b4fc3952c27b3a86782fc05192f322b2309125cd85b1fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1406,9 +1440,9 @@ dependencies = [ [[package]] name = "semihosting" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5669d73a3503b5d34db3359c8c87d1b33ba68b2630c153e340d106c15a8626a7" +checksum = "ddf1a1656965566eadb72f35770bab8daff86151cb8636ae5aa86ddf00a1f4da" [[package]] name = "sensirion-i2c" @@ -1458,7 +1492,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1564,7 +1598,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1593,9 +1627,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.112" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21f182278bf2d2bcb3c88b1b08a37df029d71ce3d3ae26168e3c653b213b99d4" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -1628,7 +1662,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] [[package]] @@ -1752,6 +1786,7 @@ dependencies = [ "esp-rtos", "lcd-lcm1602-i2c", "log", + "nb 1.1.0", "scd4x", "smoltcp", "static_cell", @@ -1818,5 +1853,5 @@ checksum = "96fb42cd29c42f8744c74276e9f5bee7b06685bbe5b88df891516d72cb320450" dependencies = [ "proc-macro2", "quote", - "syn 2.0.112", + "syn 2.0.114", ] diff --git a/Cargo.toml b/Cargo.toml index d1256a1..83bf00e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,7 @@ smoltcp = { version = "0.12.0", default-features = false, features = [ "dns-max-server-count-4", ] } embassy-ha = { git= "https://github.com/ToBinio/embassy-ha" } +nb = "1.1.0" [build-dependencies] dotenvy = "0.15" diff --git a/pcb/pcb.kicad_sch b/pcb/pcb.kicad_sch index 684b43d..768cd39 100644 --- a/pcb/pcb.kicad_sch +++ b/pcb/pcb.kicad_sch @@ -5,6 +5,329 @@ (uuid "f8392987-3ddd-437f-94e8-8fae610849f1") (paper "A4") (lib_symbols + (symbol "Device:R" + (pin_numbers + (hide yes) + ) + (pin_names + (offset 0) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "R" + (at 2.032 0 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "R" + (at 0 0 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at -1.778 0 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "R res resistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "R_*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "R_0_1" + (rectangle + (start -1.016 -2.54) + (end 1.016 2.54) + (stroke + (width 0.254) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "R_1_1" + (pin passive line + (at 0 3.81 270) + (length 1.27) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 0 -3.81 90) + (length 1.27) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (embedded_fonts no) + ) + (symbol "Device:R_Photo" + (pin_numbers + (hide yes) + ) + (pin_names + (offset 0) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "R" + (at 1.27 1.27 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "R_Photo" + (at 1.27 0 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left top) + ) + ) + (property "Footprint" "" + (at 1.27 -6.35 90) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 0 -1.27 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Photoresistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "resistor variable light sensitive opto LDR" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "*LDR* R?LDR*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "R_Photo_0_1" + (polyline + (pts + (xy -1.524 -0.762) (xy -4.064 1.778) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -0.762) (xy -2.286 -0.762) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -0.762) (xy -1.524 0) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -2.286) (xy -4.064 0.254) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -2.286) (xy -2.286 -2.286) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -2.286) (xy -1.524 -1.524) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (rectangle + (start -1.016 2.54) + (end 1.016 -2.54) + (stroke + (width 0.254) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "R_Photo_1_1" + (pin passive line + (at 0 3.81 270) + (length 1.27) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 0 -3.81 90) + (length 1.27) + (name "~" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (embedded_fonts no) + ) (symbol "RF_Module:ESP32-WROOM-32" (exclude_from_sim no) (in_bom yes) @@ -1817,20 +2140,26 @@ ) ) (junction - (at 144.78 104.14) + (at 151.13 86.36) + (diameter 0) + (color 0 0 0 0) + (uuid "7376fdc7-dc09-489e-893f-d67dccc666dc") + ) + (junction + (at 180.34 104.14) (diameter 0) (color 0 0 0 0) (uuid "b304fd36-883d-4a20-b313-7cf7b71d8c61") ) (junction - (at 142.24 106.68) + (at 177.8 106.68) (diameter 0) (color 0 0 0 0) (uuid "cf8cb18c-5d85-4906-b859-cd8e38359337") ) (wire (pts - (xy 170.18 97.79) (xy 170.18 100.33) + (xy 205.74 97.79) (xy 205.74 100.33) ) (stroke (width 0) @@ -1850,7 +2179,7 @@ ) (wire (pts - (xy 151.13 90.17) (xy 151.13 88.9) + (xy 186.69 90.17) (xy 186.69 88.9) ) (stroke (width 0) @@ -1860,7 +2189,7 @@ ) (wire (pts - (xy 133.35 88.9) (xy 133.35 90.17) + (xy 168.91 88.9) (xy 168.91 90.17) ) (stroke (width 0) @@ -1870,7 +2199,7 @@ ) (wire (pts - (xy 127 106.68) (xy 142.24 106.68) + (xy 127 106.68) (xy 177.8 106.68) ) (stroke (width 0) @@ -1880,7 +2209,7 @@ ) (wire (pts - (xy 167.64 97.79) (xy 167.64 104.14) + (xy 203.2 97.79) (xy 203.2 104.14) ) (stroke (width 0) @@ -1890,7 +2219,17 @@ ) (wire (pts - (xy 127 104.14) (xy 144.78 104.14) + (xy 151.13 86.36) (xy 152.4 86.36) + ) + (stroke + (width 0) + (type default) + ) + (uuid "2ce1e628-2740-4ed7-9ab6-0cb88690fc34") + ) + (wire + (pts + (xy 127 104.14) (xy 180.34 104.14) ) (stroke (width 0) @@ -1910,7 +2249,7 @@ ) (wire (pts - (xy 180.34 88.9) (xy 179.07 88.9) + (xy 215.9 88.9) (xy 214.63 88.9) ) (stroke (width 0) @@ -1920,7 +2259,7 @@ ) (wire (pts - (xy 144.78 99.06) (xy 144.78 104.14) + (xy 180.34 99.06) (xy 180.34 104.14) ) (stroke (width 0) @@ -1930,7 +2269,27 @@ ) (wire (pts - (xy 157.48 90.17) (xy 157.48 88.9) + (xy 140.97 86.36) (xy 142.24 86.36) + ) + (stroke + (width 0) + (type default) + ) + (uuid "48ae811d-b9b9-43fa-95c0-149414804c3f") + ) + (wire + (pts + (xy 130.81 91.44) (xy 151.13 91.44) + ) + (stroke + (width 0) + (type default) + ) + (uuid "4e61afa8-34a0-439a-964b-6025ff3f2274") + ) + (wire + (pts + (xy 193.04 90.17) (xy 193.04 88.9) ) (stroke (width 0) @@ -1950,7 +2309,7 @@ ) (wire (pts - (xy 157.48 88.9) (xy 158.75 88.9) + (xy 193.04 88.9) (xy 194.31 88.9) ) (stroke (width 0) @@ -1960,7 +2319,7 @@ ) (wire (pts - (xy 151.13 88.9) (xy 149.86 88.9) + (xy 186.69 88.9) (xy 185.42 88.9) ) (stroke (width 0) @@ -1968,6 +2327,16 @@ ) (uuid "69e635b6-60b1-4fbe-9b17-6013a3021ba5") ) + (wire + (pts + (xy 151.13 86.36) (xy 151.13 91.44) + ) + (stroke + (width 0) + (type default) + ) + (uuid "6d0960ca-3ada-418c-badd-d68a5f76b80a") + ) (wire (pts (xy 133.35 124.46) (xy 133.35 125.73) @@ -1980,63 +2349,103 @@ ) (wire (pts - (xy 133.35 125.73) (xy 134.62 125.73) + (xy 133.35 125.73) (xy 134.62 125.73) + ) + (stroke + (width 0) + (type default) + ) + (uuid "79bcc42e-0684-449c-9c6a-e6e01329d114") + ) + (wire + (pts + (xy 158.75 125.73) (xy 157.48 125.73) + ) + (stroke + (width 0) + (type default) + ) + (uuid "82379f7e-6c1e-471c-82d5-ef855a1bf758") + ) + (wire + (pts + (xy 140.97 85.09) (xy 140.97 86.36) + ) + (stroke + (width 0) + (type default) + ) + (uuid "905ee16e-01ac-44fc-bc3a-de9ec7526e7e") + ) + (wire + (pts + (xy 177.8 99.06) (xy 177.8 106.68) + ) + (stroke + (width 0) + (type default) + ) + (uuid "9690a942-0798-4354-96cd-8bd473d09b98") + ) + (wire + (pts + (xy 127 114.3) (xy 147.32 114.3) ) (stroke (width 0) (type default) ) - (uuid "79bcc42e-0684-449c-9c6a-e6e01329d114") + (uuid "a09c5926-48cb-4534-82bc-e6c8c20115c0") ) (wire (pts - (xy 158.75 125.73) (xy 157.48 125.73) + (xy 111.76 60.96) (xy 111.76 63.5) ) (stroke (width 0) (type default) ) - (uuid "82379f7e-6c1e-471c-82d5-ef855a1bf758") + (uuid "a337dd96-ff66-42ef-8852-060bbbf14b2b") ) (wire (pts - (xy 142.24 99.06) (xy 142.24 106.68) + (xy 144.78 111.76) (xy 144.78 118.11) ) (stroke (width 0) (type default) ) - (uuid "9690a942-0798-4354-96cd-8bd473d09b98") + (uuid "a60c3787-e7fa-4a18-98a2-3947b6e6c788") ) (wire (pts - (xy 127 114.3) (xy 147.32 114.3) + (xy 130.81 119.38) (xy 130.81 91.44) ) (stroke (width 0) (type default) ) - (uuid "a09c5926-48cb-4534-82bc-e6c8c20115c0") + (uuid "ac8a3ca0-ef9e-4d0c-a950-bc98dd804d7c") ) (wire (pts - (xy 111.76 60.96) (xy 111.76 63.5) + (xy 161.29 86.36) (xy 160.02 86.36) ) (stroke (width 0) (type default) ) - (uuid "a337dd96-ff66-42ef-8852-060bbbf14b2b") + (uuid "ae6c943b-bbf3-4710-9201-4577117a4b74") ) (wire (pts - (xy 144.78 111.76) (xy 144.78 118.11) + (xy 161.29 85.09) (xy 161.29 86.36) ) (stroke (width 0) (type default) ) - (uuid "a60c3787-e7fa-4a18-98a2-3947b6e6c788") + (uuid "affa33e0-6399-49c2-b010-d588e719ce65") ) (wire (pts @@ -2050,7 +2459,7 @@ ) (wire (pts - (xy 133.35 88.9) (xy 134.62 88.9) + (xy 168.91 88.9) (xy 170.18 88.9) ) (stroke (width 0) @@ -2060,7 +2469,7 @@ ) (wire (pts - (xy 180.34 90.17) (xy 180.34 88.9) + (xy 215.9 90.17) (xy 215.9 88.9) ) (stroke (width 0) @@ -2080,7 +2489,17 @@ ) (wire (pts - (xy 144.78 104.14) (xy 167.64 104.14) + (xy 151.13 86.36) (xy 149.86 86.36) + ) + (stroke + (width 0) + (type default) + ) + (uuid "e075e191-08e8-4c32-99f9-1a2c17f32261") + ) + (wire + (pts + (xy 180.34 104.14) (xy 203.2 104.14) ) (stroke (width 0) @@ -2090,7 +2509,7 @@ ) (wire (pts - (xy 165.1 97.79) (xy 165.1 106.68) + (xy 200.66 97.79) (xy 200.66 106.68) ) (stroke (width 0) @@ -2110,7 +2529,17 @@ ) (wire (pts - (xy 142.24 106.68) (xy 165.1 106.68) + (xy 127 119.38) (xy 130.81 119.38) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f1c59d68-1189-4c74-bf7c-267d2bb10925") + ) + (wire + (pts + (xy 177.8 106.68) (xy 200.66 106.68) ) (stroke (width 0) @@ -2130,7 +2559,7 @@ ) (symbol (lib_id "power:+3.3V") - (at 151.13 90.17 180) + (at 186.69 90.17 180) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -2139,7 +2568,7 @@ (fields_autoplaced yes) (uuid "0df13fa2-24a1-46e3-899b-88a169c5340e") (property "Reference" "#PWR04" - (at 151.13 86.36 0) + (at 186.69 86.36 0) (effects (font (size 1.27 1.27) @@ -2148,7 +2577,7 @@ ) ) (property "Value" "+3.3V" - (at 151.13 95.25 0) + (at 186.69 95.25 0) (effects (font (size 1.27 1.27) @@ -2156,7 +2585,7 @@ ) ) (property "Footprint" "" - (at 151.13 90.17 0) + (at 186.69 90.17 0) (effects (font (size 1.27 1.27) @@ -2165,7 +2594,7 @@ ) ) (property "Datasheet" "" - (at 151.13 90.17 0) + (at 186.69 90.17 0) (effects (font (size 1.27 1.27) @@ -2174,7 +2603,7 @@ ) ) (property "Description" "Power symbol creates a global label with name \"+3.3V\"" - (at 151.13 90.17 0) + (at 186.69 90.17 0) (effects (font (size 1.27 1.27) @@ -2194,6 +2623,73 @@ ) ) ) + (symbol + (lib_id "power:GND") + (at 161.29 85.09 180) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "2713e30a-afb2-451f-bcd9-84ddb8291cb4") + (property "Reference" "#PWR011" + (at 161.29 78.74 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Value" "GND" + (at 161.2899 81.28 90) + (effects + (font + (size 1.27 1.27) + ) + (justify right) + ) + ) + (property "Footprint" "" + (at 161.29 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 161.29 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Power symbol creates a global label with name \"GND\" , ground" + (at 161.29 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "0e400f40-d180-4caf-b06a-7b39896d248e") + ) + (instances + (project "" + (path "/f8392987-3ddd-437f-94e8-8fae610849f1" + (reference "#PWR011") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "power:+5V") (at 111.76 60.96 0) @@ -2441,6 +2937,73 @@ ) ) ) + (symbol + (lib_id "power:+3.3V") + (at 140.97 85.09 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "4f2495ff-1bf5-4b0f-a7ae-01a223d1d882") + (property "Reference" "#PWR012" + (at 140.97 88.9 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Value" "+3.3V" + (at 140.9699 81.28 90) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "" + (at 140.97 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "" + (at 140.97 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Power symbol creates a global label with name \"+3.3V\"" + (at 140.97 85.09 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "2948c85e-b3ee-40b8-ad1a-6caa02d34c9b") + ) + (instances + (project "" + (path "/f8392987-3ddd-437f-94e8-8fae610849f1" + (reference "#PWR012") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "power:GND") (at 111.76 137.16 0) @@ -2648,7 +3211,7 @@ ) (symbol (lib_id "Sensor_Gas:SCD41-D-R2") - (at 142.24 88.9 270) + (at 177.8 88.9 270) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -2657,7 +3220,7 @@ (fields_autoplaced yes) (uuid "73ebff3a-236c-4c7e-9062-d8daac159ce1") (property "Reference" "U2" - (at 142.24 76.2 90) + (at 177.8 76.2 90) (effects (font (size 1.27 1.27) @@ -2665,7 +3228,7 @@ ) ) (property "Value" "SCD41-D-R2" - (at 142.24 78.74 90) + (at 177.8 78.74 90) (effects (font (size 1.27 1.27) @@ -2673,7 +3236,7 @@ ) ) (property "Footprint" "Sensor:Sensirion_SCD4x-1EP_10.1x10.1mm_P1.25mm_EP4.8x4.8mm" - (at 142.24 88.9 0) + (at 177.8 88.9 0) (effects (font (size 1.27 1.27) @@ -2682,7 +3245,7 @@ ) ) (property "Datasheet" "https://sensirion.com/media/documents/E0F04247/631EF271/CD_DS_SCD40_SCD41_Datasheet_D1.pdf" - (at 142.24 88.9 0) + (at 177.8 88.9 0) (effects (font (size 1.27 1.27) @@ -2691,7 +3254,7 @@ ) ) (property "Description" "Photoacoustic CO2 sensor, 40 000 ppm, I2C, 2.4-5.5 V, High accuracy 400 - 5000 ppm" - (at 142.24 88.9 0) + (at 177.8 88.9 0) (effects (font (size 1.27 1.27) @@ -2729,6 +3292,74 @@ ) ) ) + (symbol + (lib_id "Device:R") + (at 156.21 86.36 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "77a93b95-5706-4893-b66e-95e759dae0e8") + (property "Reference" "R2" + (at 156.21 80.01 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "1m" + (at 156.21 82.55 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "" + (at 156.21 88.138 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 156.21 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 156.21 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "697ed6cb-6472-413e-a5f3-b19330d7f13d") + ) + (pin "2" + (uuid "7c42b6e6-572b-4242-903c-12af2413f506") + ) + (instances + (project "" + (path "/f8392987-3ddd-437f-94e8-8fae610849f1" + (reference "R2") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "power:+5V") (at 158.75 124.46 0) @@ -2863,7 +3494,7 @@ ) (symbol (lib_id "power:+3.3V") - (at 157.48 90.17 180) + (at 193.04 90.17 180) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -2872,7 +3503,7 @@ (fields_autoplaced yes) (uuid "97fbbc7b-d0bc-4bec-8ede-6fc8d8445e6d") (property "Reference" "#PWR05" - (at 157.48 86.36 0) + (at 193.04 86.36 0) (effects (font (size 1.27 1.27) @@ -2881,7 +3512,7 @@ ) ) (property "Value" "+3.3V" - (at 157.48 95.25 0) + (at 193.04 95.25 0) (effects (font (size 1.27 1.27) @@ -2889,7 +3520,7 @@ ) ) (property "Footprint" "" - (at 157.48 90.17 0) + (at 193.04 90.17 0) (effects (font (size 1.27 1.27) @@ -2898,7 +3529,7 @@ ) ) (property "Datasheet" "" - (at 157.48 90.17 0) + (at 193.04 90.17 0) (effects (font (size 1.27 1.27) @@ -2907,7 +3538,7 @@ ) ) (property "Description" "Power symbol creates a global label with name \"+3.3V\"" - (at 157.48 90.17 0) + (at 193.04 90.17 0) (effects (font (size 1.27 1.27) @@ -2929,7 +3560,7 @@ ) (symbol (lib_id "power:GND") - (at 133.35 90.17 0) + (at 168.91 90.17 0) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -2938,7 +3569,7 @@ (fields_autoplaced yes) (uuid "9ea9b245-e9dd-43fe-a7b5-67f9be9932f2") (property "Reference" "#PWR03" - (at 133.35 96.52 0) + (at 168.91 96.52 0) (effects (font (size 1.27 1.27) @@ -2947,7 +3578,7 @@ ) ) (property "Value" "GND" - (at 133.35 95.25 0) + (at 168.91 95.25 0) (effects (font (size 1.27 1.27) @@ -2955,7 +3586,7 @@ ) ) (property "Footprint" "" - (at 133.35 90.17 0) + (at 168.91 90.17 0) (effects (font (size 1.27 1.27) @@ -2964,7 +3595,7 @@ ) ) (property "Datasheet" "" - (at 133.35 90.17 0) + (at 168.91 90.17 0) (effects (font (size 1.27 1.27) @@ -2973,7 +3604,7 @@ ) ) (property "Description" "Power symbol creates a global label with name \"GND\" , ground" - (at 133.35 90.17 0) + (at 168.91 90.17 0) (effects (font (size 1.27 1.27) @@ -2993,9 +3624,79 @@ ) ) ) + (symbol + (lib_id "Device:R_Photo") + (at 146.05 86.36 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (uuid "a72d8f0a-c4c6-4d25-9a1d-236cbdf1d412") + (property "Reference" "R1" + (at 144.7799 83.82 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "R_Photo" + (at 147.3199 83.82 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "" + (at 152.4 85.09 90) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 147.32 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Photoresistor" + (at 146.05 86.36 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "2" + (uuid "da6d7e4c-bbe2-467d-95de-97c745a75863") + ) + (pin "1" + (uuid "d58134a6-5f80-4912-bbca-17023009f908") + ) + (instances + (project "" + (path "/f8392987-3ddd-437f-94e8-8fae610849f1" + (reference "R1") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "power:GND") - (at 180.34 90.17 0) + (at 215.9 90.17 0) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -3004,7 +3705,7 @@ (fields_autoplaced yes) (uuid "af614716-36b5-42d3-b8de-b385f07c1ab2") (property "Reference" "#PWR06" - (at 180.34 96.52 0) + (at 215.9 96.52 0) (effects (font (size 1.27 1.27) @@ -3013,7 +3714,7 @@ ) ) (property "Value" "GND" - (at 180.34 95.25 0) + (at 215.9 95.25 0) (effects (font (size 1.27 1.27) @@ -3021,7 +3722,7 @@ ) ) (property "Footprint" "" - (at 180.34 90.17 0) + (at 215.9 90.17 0) (effects (font (size 1.27 1.27) @@ -3030,7 +3731,7 @@ ) ) (property "Datasheet" "" - (at 180.34 90.17 0) + (at 215.9 90.17 0) (effects (font (size 1.27 1.27) @@ -3039,7 +3740,7 @@ ) ) (property "Description" "Power symbol creates a global label with name \"GND\" , ground" - (at 180.34 90.17 0) + (at 215.9 90.17 0) (effects (font (size 1.27 1.27) @@ -3061,7 +3762,7 @@ ) (symbol (lib_id "power:GND") - (at 170.18 100.33 0) + (at 205.74 100.33 0) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -3070,7 +3771,7 @@ (fields_autoplaced yes) (uuid "cc45ee7c-6fd5-49f0-a151-7ef6e29f2dd9") (property "Reference" "#PWR09" - (at 170.18 106.68 0) + (at 205.74 106.68 0) (effects (font (size 1.27 1.27) @@ -3079,7 +3780,7 @@ ) ) (property "Value" "GND" - (at 170.18 105.41 0) + (at 205.74 105.41 0) (effects (font (size 1.27 1.27) @@ -3087,7 +3788,7 @@ ) ) (property "Footprint" "" - (at 170.18 100.33 0) + (at 205.74 100.33 0) (effects (font (size 1.27 1.27) @@ -3096,7 +3797,7 @@ ) ) (property "Datasheet" "" - (at 170.18 100.33 0) + (at 205.74 100.33 0) (effects (font (size 1.27 1.27) @@ -3105,7 +3806,7 @@ ) ) (property "Description" "Power symbol creates a global label with name \"GND\" , ground" - (at 170.18 100.33 0) + (at 205.74 100.33 0) (effects (font (size 1.27 1.27) @@ -3197,7 +3898,7 @@ ) (symbol (lib_id "custom_symbols:BME680_Module") - (at 168.91 88.9 90) + (at 204.47 88.9 90) (unit 1) (exclude_from_sim no) (in_bom yes) @@ -3206,7 +3907,7 @@ (fields_autoplaced yes) (uuid "ffd1da45-32b3-490e-a423-ffd1a2d8803d") (property "Reference" "U3" - (at 168.91 77.47 90) + (at 204.47 77.47 90) (effects (font (size 1.27 1.27) @@ -3214,7 +3915,7 @@ ) ) (property "Value" "BME680" - (at 168.91 80.01 90) + (at 204.47 80.01 90) (effects (font (size 1.27 1.27) @@ -3222,7 +3923,7 @@ ) ) (property "Footprint" "" - (at 168.91 88.9 0) + (at 204.47 88.9 0) (effects (font (size 1.27 1.27) @@ -3231,7 +3932,7 @@ ) ) (property "Datasheet" "" - (at 168.91 88.9 0) + (at 204.47 88.9 0) (effects (font (size 1.27 1.27) @@ -3240,7 +3941,7 @@ ) ) (property "Description" "" - (at 168.91 88.9 0) + (at 204.47 88.9 0) (effects (font (size 1.27 1.27) diff --git a/src/main.rs b/src/main.rs index 24b0eb0..2a269a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,12 +16,13 @@ use embassy_sync::channel::{Channel, Receiver, Sender}; use embassy_sync::mutex::Mutex; use embassy_time::{Delay, Duration, Timer}; use esp_backtrace as _; -use esp_hal::Async; +use esp_hal::analog::adc::{Adc, AdcConfig, AdcPin}; use esp_hal::clock::CpuClock; use esp_hal::gpio::{Input, InputConfig}; use esp_hal::i2c::master::{Config as I2cConfig, I2c}; -use esp_hal::peripherals::Peripherals; +use esp_hal::peripherals::{ADC1, GPIO32, Peripherals}; use esp_hal::timer::timg::TimerGroup; +use esp_hal::{Async, Blocking}; use lcd_lcm1602_i2c::async_lcd::Lcd; use log::{info, warn}; use scd4x::Scd4xAsync; @@ -109,6 +110,10 @@ async fn main(spawner: Spawner) { static CHANNEL: StaticCell = StaticCell::new(); let event_channel = CHANNEL.init(Channel::new()); + let mut config = AdcConfig::new(); + let pin = config.enable_pin(peripherals.GPIO32, esp_hal::analog::adc::Attenuation::_11dB); + let adc = Adc::new(peripherals.ADC1, config); + spawner .spawn(read_bme_680(i2c_v33, event_channel.sender())) .expect("Failed to spawn read_bme_680 task"); @@ -121,6 +126,9 @@ async fn main(spawner: Spawner) { spawner .spawn(process_data(i2c_v5, ha_sensors, event_channel.receiver())) .expect("Failed to spawn process_data task"); + spawner + .spawn(dim_lcd_backlight(adc, pin)) + .expect("Failed to spawn read_adc task"); info!("Tasks initialized!"); } @@ -277,6 +285,26 @@ impl DisplayMode { } } +#[embassy_executor::task] +async fn dim_lcd_backlight( + mut adc: Adc<'static, ADC1<'static>, Blocking>, + mut pin: AdcPin, ADC1<'static>>, +) { + loop { + match adc.read_oneshot(&mut pin) { + Ok(value) => { + info!("ADC value: {}", value); + } + Err(nb::Error::WouldBlock) => {} + Err(nb::Error::Other(err)) => { + warn!("Failed to read ADC value - {:?}", err); + } + } + + Timer::after(Duration::from_millis(500)).await; + } +} + #[embassy_executor::task] async fn process_data( mut i2c: I2c<'static, Async>,