added firmware section
This commit is contained in:
@@ -68,8 +68,8 @@
|
||||
(allow_soldermask_bridges_in_footprints no)
|
||||
(tenting front back)
|
||||
(pcbplotparams
|
||||
(layerselection 0x00000000_00000000_55555555_5755f5ff)
|
||||
(plot_on_all_layers_selection 0x00000000_00000000_00000000_00000000)
|
||||
(layerselection 0x00000000_00000000_55555555_555555d0)
|
||||
(plot_on_all_layers_selection 0x00000000_00000000_00000000_02008000)
|
||||
(disableapertmacros no)
|
||||
(usegerberextensions no)
|
||||
(usegerberattributes yes)
|
||||
@@ -100,9 +100,9 @@
|
||||
(sketchdnponfab yes)
|
||||
(crossoutdnponfab yes)
|
||||
(subtractmaskfromsilk no)
|
||||
(outputformat 1)
|
||||
(outputformat 5)
|
||||
(mirror no)
|
||||
(drillshape 1)
|
||||
(drillshape 0)
|
||||
(scaleselection 1)
|
||||
(outputdirectory "")
|
||||
)
|
||||
@@ -4029,19 +4029,6 @@
|
||||
(justify bottom mirror)
|
||||
)
|
||||
)
|
||||
(gr_text "SENSOR"
|
||||
(at 34.544 40.767 0)
|
||||
(layer "F.SilkS")
|
||||
(uuid "3274ea7c-b64f-4229-b4b2-adc8cbdd17a6")
|
||||
(effects
|
||||
(font
|
||||
(size 0.8128 0.8128)
|
||||
(thickness 0.1524)
|
||||
(bold yes)
|
||||
)
|
||||
(justify left bottom)
|
||||
)
|
||||
)
|
||||
(gr_text "GND"
|
||||
(at 34.544 43.053 0)
|
||||
(layer "F.SilkS")
|
||||
@@ -4068,6 +4055,19 @@
|
||||
(justify left bottom)
|
||||
)
|
||||
)
|
||||
(gr_text "SENSOR"
|
||||
(at 34.65 40.55 0)
|
||||
(layer "F.SilkS")
|
||||
(uuid "3274ea7c-b64f-4229-b4b2-adc8cbdd17a6")
|
||||
(effects
|
||||
(font
|
||||
(size 0.8128 0.8128)
|
||||
(thickness 0.1524)
|
||||
(bold yes)
|
||||
)
|
||||
(justify left bottom)
|
||||
)
|
||||
)
|
||||
(gr_text "ALARM CNC"
|
||||
(at 41.5 13.547 0)
|
||||
(layer "F.SilkS")
|
||||
@@ -4120,10 +4120,10 @@
|
||||
(justify right bottom)
|
||||
)
|
||||
)
|
||||
(gr_text "VCC"
|
||||
(at 35.977 8.128 90)
|
||||
(gr_text "GND"
|
||||
(at 35.9 8.2 90)
|
||||
(layer "F.SilkS")
|
||||
(uuid "28f438a7-b55b-414b-95c5-54379ad95405")
|
||||
(uuid "4dca8764-21dc-4b40-8815-cb83450a8ad1")
|
||||
(effects
|
||||
(font
|
||||
(size 0.8128 0.8128)
|
||||
@@ -4133,10 +4133,10 @@
|
||||
(justify right bottom)
|
||||
)
|
||||
)
|
||||
(gr_text "GND"
|
||||
(at 38.481 8.128 90)
|
||||
(gr_text "VCC"
|
||||
(at 38.55 8.15 90)
|
||||
(layer "F.SilkS")
|
||||
(uuid "4dca8764-21dc-4b40-8815-cb83450a8ad1")
|
||||
(uuid "28f438a7-b55b-414b-95c5-54379ad95405")
|
||||
(effects
|
||||
(font
|
||||
(size 0.8128 0.8128)
|
||||
@@ -5155,74 +5155,75 @@
|
||||
(xy 36.638455 7.303547) (xy 36.753664 7.389793) (xy 36.753671 7.389797) (xy 36.888516 7.440091)
|
||||
(xy 36.934757 7.445063) (xy 36.999307 7.471801) (xy 37.039155 7.529194) (xy 37.0455 7.568352) (xy 37.0455 7.774846)
|
||||
(xy 37.076261 7.929489) (xy 37.076264 7.929501) (xy 37.136602 8.075172) (xy 37.136609 8.075185)
|
||||
(xy 37.22421 8.206288) (xy 37.224213 8.206292) (xy 38.128211 9.110289) (xy 38.239711 9.221789) (xy 38.239712 9.22179)
|
||||
(xy 38.370814 9.30939) (xy 38.370827 9.309397) (xy 38.516498 9.369735) (xy 38.516503 9.369737) (xy 38.671153 9.400499)
|
||||
(xy 38.671156 9.4005) (xy 38.671158 9.4005) (xy 46.11706 9.4005) (xy 46.184099 9.420185) (xy 46.204741 9.436819)
|
||||
(xy 46.963181 10.195259) (xy 46.996666 10.256582) (xy 46.9995 10.28294) (xy 46.9995 16.31706) (xy 46.979815 16.384099)
|
||||
(xy 46.963181 16.404741) (xy 46.204741 17.163181) (xy 46.177813 17.177884) (xy 46.151995 17.194477)
|
||||
(xy 46.145794 17.195368) (xy 46.143418 17.196666) (xy 46.11706 17.1995) (xy 46.088733 17.1995) (xy 46.021694 17.179815)
|
||||
(xy 45.975939 17.127011) (xy 45.971028 17.114506) (xy 45.965008 17.096341) (xy 45.959814 17.080666)
|
||||
(xy 45.867712 16.931344) (xy 45.743656 16.807288) (xy 45.594334 16.715186) (xy 45.594332 16.715185)
|
||||
(xy 45.58844 16.711551) (xy 45.541716 16.659603) (xy 45.530493 16.590641) (xy 45.558337 16.526558)
|
||||
(xy 45.565856 16.51833) (xy 45.704728 16.379458) (xy 45.82962 16.207557) (xy 45.926095 16.018217)
|
||||
(xy 45.991757 15.816129) (xy 45.991757 15.816126) (xy 46.002231 15.75) (xy 44.954146 15.75) (xy 44.99263 15.683343)
|
||||
(xy 45.025 15.562535) (xy 45.025 15.437465) (xy 44.99263 15.316657) (xy 44.954146 15.25) (xy 46.002231 15.25)
|
||||
(xy 45.991757 15.183873) (xy 45.991757 15.18387) (xy 45.926095 14.981782) (xy 45.82962 14.792442)
|
||||
(xy 45.704727 14.62054) (xy 45.704723 14.620535) (xy 45.554464 14.470276) (xy 45.554459 14.470272)
|
||||
(xy 45.389781 14.350627) (xy 45.347115 14.295297) (xy 45.341136 14.225684) (xy 45.373741 14.163889)
|
||||
(xy 45.389776 14.149994) (xy 45.554792 14.030104) (xy 45.705104 13.879792) (xy 45.705106 13.879788)
|
||||
(xy 45.705109 13.879786) (xy 45.830048 13.70782) (xy 45.830047 13.70782) (xy 45.830051 13.707816)
|
||||
(xy 45.926557 13.518412) (xy 45.992246 13.316243) (xy 46.0255 13.106287) (xy 46.0255 12.893713)
|
||||
(xy 45.992246 12.683757) (xy 45.926557 12.481588) (xy 45.830051 12.292184) (xy 45.830049 12.292181)
|
||||
(xy 45.830048 12.292179) (xy 45.705109 12.120213) (xy 45.554786 11.96989) (xy 45.38282 11.844951)
|
||||
(xy 45.193414 11.748444) (xy 45.193413 11.748443) (xy 45.193412 11.748443) (xy 44.991243 11.682754)
|
||||
(xy 44.991241 11.682753) (xy 44.99124 11.682753) (xy 44.829957 11.657208) (xy 44.781287 11.6495)
|
||||
(xy 44.318713 11.6495) (xy 44.270042 11.657208) (xy 44.10876 11.682753) (xy 43.906585 11.748444)
|
||||
(xy 43.717179 11.844951) (xy 43.545213 11.96989) (xy 43.394892 12.120211) (xy 43.335179 12.202402)
|
||||
(xy 43.30177 12.248385) (xy 43.246442 12.291051) (xy 43.201453 12.2995) (xy 39.955969 12.2995) (xy 39.892848 12.282232)
|
||||
(xy 39.835396 12.248255) (xy 39.835393 12.248254) (xy 39.677573 12.202402) (xy 39.677567 12.202401)
|
||||
(xy 39.640701 12.1995) (xy 39.640694 12.1995) (xy 38.334306 12.1995) (xy 38.334298 12.1995) (xy 38.297432 12.202401)
|
||||
(xy 38.297426 12.202402) (xy 38.139606 12.248254) (xy 38.139603 12.248255) (xy 38.081306 12.282732)
|
||||
(xy 38.018185 12.3) (xy 37.3625 12.3) (xy 37.3625 12.85) (xy 37.6255 12.85) (xy 37.634185 12.85255)
|
||||
(xy 37.643147 12.851262) (xy 37.667187 12.86224) (xy 37.692539 12.869685) (xy 37.698466 12.876525)
|
||||
(xy 37.706703 12.880287) (xy 37.720992 12.902521) (xy 37.738294 12.922489) (xy 37.740581 12.933003)
|
||||
(xy 37.744477 12.939065) (xy 37.7495 12.974) (xy 37.7495 13.0255) (xy 37.729815 13.092539) (xy 37.677011 13.138294)
|
||||
(xy 37.6255 13.1495) (xy 36.459298 13.1495) (xy 36.422432 13.152401) (xy 36.422426 13.152402) (xy 36.277267 13.194576)
|
||||
(xy 36.242672 13.1995) (xy 34.410638 13.1995) (xy 34.343599 13.179815) (xy 34.305099 13.140597)
|
||||
(xy 34.237712 13.031344) (xy 34.113656 12.907288) (xy 33.964334 12.815186) (xy 33.797797 12.760001)
|
||||
(xy 33.797795 12.76) (xy 33.69501 12.7495) (xy 32.344998 12.7495) (xy 32.344981 12.749501) (xy 32.242203 12.76)
|
||||
(xy 32.2422 12.760001) (xy 32.075668 12.815185) (xy 32.075663 12.815187) (xy 31.926342 12.907289)
|
||||
(xy 31.802289 13.031342) (xy 31.734901 13.140597) (xy 31.682953 13.187321) (xy 31.629362 13.1995)
|
||||
(xy 28.031004 13.1995) (xy 27.895677 13.226418) (xy 27.895667 13.226421) (xy 27.768192 13.279222)
|
||||
(xy 27.653454 13.355887) (xy 26.105888 14.903453) (xy 26.105885 14.903457) (xy 26.043173 14.997313)
|
||||
(xy 25.989561 15.042118) (xy 25.952674 15.05178) (xy 25.872202 15.060001) (xy 25.8722 15.060001)
|
||||
(xy 25.705668 15.115185) (xy 25.705663 15.115187) (xy 25.556342 15.207289) (xy 25.497681 15.265951)
|
||||
(xy 25.436358 15.299436) (xy 25.366666 15.294452) (xy 25.310733 15.25258) (xy 25.286316 15.187116)
|
||||
(xy 25.286 15.17827) (xy 25.286 14.237018) (xy 25.305685 14.169979) (xy 25.322314 14.149342) (xy 27.171655 12.300001)
|
||||
(xy 35.877704 12.300001) (xy 35.877899 12.302486) (xy 35.923718 12.460198) (xy 36.007314 12.601552)
|
||||
(xy 36.007321 12.601561) (xy 36.123438 12.717678) (xy 36.123447 12.717685) (xy 36.264803 12.801282)
|
||||
(xy 36.264806 12.801283) (xy 36.422504 12.847099) (xy 36.42251 12.8471) (xy 36.45935 12.849999)
|
||||
(xy 36.459366 12.85) (xy 36.8625 12.85) (xy 36.8625 12.3) (xy 35.877705 12.3) (xy 35.877704 12.300001)
|
||||
(xy 27.171655 12.300001) (xy 27.671658 11.799998) (xy 35.877704 11.799998) (xy 35.877705 11.8) (xy 36.8625 11.8)
|
||||
(xy 37.3625 11.8) (xy 38.347295 11.8) (xy 38.347295 11.799998) (xy 38.3471 11.797513) (xy 38.301281 11.639801)
|
||||
(xy 38.217685 11.498447) (xy 38.217678 11.498438) (xy 38.101561 11.382321) (xy 38.101552 11.382314)
|
||||
(xy 37.960196 11.298717) (xy 37.960193 11.298716) (xy 37.802495 11.2529) (xy 37.802489 11.252899)
|
||||
(xy 37.765649 11.25) (xy 37.3625 11.25) (xy 37.3625 11.8) (xy 36.8625 11.8) (xy 36.8625 11.25) (xy 36.45935 11.25)
|
||||
(xy 36.42251 11.252899) (xy 36.422504 11.2529) (xy 36.264806 11.298716) (xy 36.264803 11.298717)
|
||||
(xy 36.123447 11.382314) (xy 36.123438 11.382321) (xy 36.007321 11.498438) (xy 36.007314 11.498447)
|
||||
(xy 35.923718 11.639801) (xy 35.877899 11.797513) (xy 35.877704 11.799998) (xy 27.671658 11.799998)
|
||||
(xy 32.102079 7.369576) (xy 32.1634 7.336093) (xy 32.233092 7.341077) (xy 32.246047 7.346772) (xy 32.247588 7.347557)
|
||||
(xy 32.449757 7.413246) (xy 32.659713 7.4465) (xy 32.659714 7.4465) (xy 32.872286 7.4465) (xy 32.872287 7.4465)
|
||||
(xy 33.082243 7.413246) (xy 33.284412 7.347557) (xy 33.473816 7.251051) (xy 33.560138 7.188335)
|
||||
(xy 33.645786 7.126109) (xy 33.645788 7.126106) (xy 33.645792 7.126104) (xy 33.796104 6.975792)
|
||||
(xy 33.796106 6.975788) (xy 33.796109 6.975786) (xy 33.863515 6.883007) (xy 33.921051 6.803816)
|
||||
(xy 33.925793 6.794508) (xy 33.973763 6.743711) (xy 34.041583 6.726911) (xy 34.107719 6.749445)
|
||||
(xy 34.146763 6.7945) (xy 34.151373 6.803547) (xy 34.190728 6.857716) (xy 34.823037 6.225408) (xy 34.840075 6.288993)
|
||||
(xy 34.905901 6.403007) (xy 34.998993 6.496099) (xy 35.113007 6.561925) (xy 35.17659 6.578962) (xy 34.544282 7.211269)
|
||||
(xy 34.544282 7.21127) (xy 34.598449 7.250624) (xy 34.787782 7.347095) (xy 34.98987 7.412757) (xy 35.199754 7.446)
|
||||
(xy 35.412246 7.446) (xy 35.622127 7.412757) (xy 35.62213 7.412757) (xy 35.824217 7.347095) (xy 36.013554 7.250622)
|
||||
(xy 36.067716 7.21127) (xy 36.067717 7.21127) (xy 35.435408 6.578962) (xy 35.498993 6.561925) (xy 35.613007 6.496099)
|
||||
(xy 35.706099 6.403007) (xy 35.771925 6.288993) (xy 35.788962 6.225408)
|
||||
(xy 37.22421 8.206288) (xy 37.224213 8.206292) (xy 38.239707 9.221786) (xy 38.239711 9.221789) (xy 38.370814 9.30939)
|
||||
(xy 38.370827 9.309397) (xy 38.516498 9.369735) (xy 38.516503 9.369737) (xy 38.671153 9.400499)
|
||||
(xy 38.671156 9.4005) (xy 38.671158 9.4005) (xy 38.828842 9.4005) (xy 46.11706 9.4005) (xy 46.184099 9.420185)
|
||||
(xy 46.204741 9.436819) (xy 46.963181 10.195259) (xy 46.996666 10.256582) (xy 46.9995 10.28294)
|
||||
(xy 46.9995 16.31706) (xy 46.979815 16.384099) (xy 46.963181 16.404741) (xy 46.204741 17.163181)
|
||||
(xy 46.177813 17.177884) (xy 46.151995 17.194477) (xy 46.145794 17.195368) (xy 46.143418 17.196666)
|
||||
(xy 46.11706 17.1995) (xy 46.088733 17.1995) (xy 46.021694 17.179815) (xy 45.975939 17.127011) (xy 45.971028 17.114506)
|
||||
(xy 45.965008 17.096341) (xy 45.959814 17.080666) (xy 45.867712 16.931344) (xy 45.743656 16.807288)
|
||||
(xy 45.594334 16.715186) (xy 45.594332 16.715185) (xy 45.58844 16.711551) (xy 45.541716 16.659603)
|
||||
(xy 45.530493 16.590641) (xy 45.558337 16.526558) (xy 45.565856 16.51833) (xy 45.704728 16.379458)
|
||||
(xy 45.82962 16.207557) (xy 45.926095 16.018217) (xy 45.991757 15.816129) (xy 45.991757 15.816126)
|
||||
(xy 46.002231 15.75) (xy 44.954146 15.75) (xy 44.99263 15.683343) (xy 45.025 15.562535) (xy 45.025 15.437465)
|
||||
(xy 44.99263 15.316657) (xy 44.954146 15.25) (xy 46.002231 15.25) (xy 45.991757 15.183873) (xy 45.991757 15.18387)
|
||||
(xy 45.926095 14.981782) (xy 45.82962 14.792442) (xy 45.704727 14.62054) (xy 45.704723 14.620535)
|
||||
(xy 45.554464 14.470276) (xy 45.554459 14.470272) (xy 45.389781 14.350627) (xy 45.347115 14.295297)
|
||||
(xy 45.341136 14.225684) (xy 45.373741 14.163889) (xy 45.389776 14.149994) (xy 45.554792 14.030104)
|
||||
(xy 45.705104 13.879792) (xy 45.705106 13.879788) (xy 45.705109 13.879786) (xy 45.830048 13.70782)
|
||||
(xy 45.830047 13.70782) (xy 45.830051 13.707816) (xy 45.926557 13.518412) (xy 45.992246 13.316243)
|
||||
(xy 46.0255 13.106287) (xy 46.0255 12.893713) (xy 45.992246 12.683757) (xy 45.926557 12.481588)
|
||||
(xy 45.830051 12.292184) (xy 45.830049 12.292181) (xy 45.830048 12.292179) (xy 45.705109 12.120213)
|
||||
(xy 45.554786 11.96989) (xy 45.38282 11.844951) (xy 45.193414 11.748444) (xy 45.193413 11.748443)
|
||||
(xy 45.193412 11.748443) (xy 44.991243 11.682754) (xy 44.991241 11.682753) (xy 44.99124 11.682753)
|
||||
(xy 44.829957 11.657208) (xy 44.781287 11.6495) (xy 44.318713 11.6495) (xy 44.270042 11.657208)
|
||||
(xy 44.10876 11.682753) (xy 43.906585 11.748444) (xy 43.717179 11.844951) (xy 43.545213 11.96989)
|
||||
(xy 43.394892 12.120211) (xy 43.335179 12.202402) (xy 43.30177 12.248385) (xy 43.246442 12.291051)
|
||||
(xy 43.201453 12.2995) (xy 39.955969 12.2995) (xy 39.892848 12.282232) (xy 39.835396 12.248255)
|
||||
(xy 39.835393 12.248254) (xy 39.677573 12.202402) (xy 39.677567 12.202401) (xy 39.640701 12.1995)
|
||||
(xy 39.640694 12.1995) (xy 38.334306 12.1995) (xy 38.334298 12.1995) (xy 38.297432 12.202401) (xy 38.297426 12.202402)
|
||||
(xy 38.139606 12.248254) (xy 38.139603 12.248255) (xy 38.081306 12.282732) (xy 38.018185 12.3) (xy 37.3625 12.3)
|
||||
(xy 37.3625 12.85) (xy 37.6255 12.85) (xy 37.634185 12.85255) (xy 37.643147 12.851262) (xy 37.667187 12.86224)
|
||||
(xy 37.692539 12.869685) (xy 37.698466 12.876525) (xy 37.706703 12.880287) (xy 37.720992 12.902521)
|
||||
(xy 37.738294 12.922489) (xy 37.740581 12.933003) (xy 37.744477 12.939065) (xy 37.7495 12.974) (xy 37.7495 13.0255)
|
||||
(xy 37.729815 13.092539) (xy 37.677011 13.138294) (xy 37.6255 13.1495) (xy 36.459298 13.1495) (xy 36.422432 13.152401)
|
||||
(xy 36.422426 13.152402) (xy 36.277267 13.194576) (xy 36.242672 13.1995) (xy 34.410638 13.1995)
|
||||
(xy 34.343599 13.179815) (xy 34.305099 13.140597) (xy 34.237712 13.031344) (xy 34.113656 12.907288)
|
||||
(xy 33.964334 12.815186) (xy 33.797797 12.760001) (xy 33.797795 12.76) (xy 33.69501 12.7495) (xy 32.344998 12.7495)
|
||||
(xy 32.344981 12.749501) (xy 32.242203 12.76) (xy 32.2422 12.760001) (xy 32.075668 12.815185) (xy 32.075663 12.815187)
|
||||
(xy 31.926342 12.907289) (xy 31.802289 13.031342) (xy 31.734901 13.140597) (xy 31.682953 13.187321)
|
||||
(xy 31.629362 13.1995) (xy 28.031004 13.1995) (xy 27.895677 13.226418) (xy 27.895667 13.226421)
|
||||
(xy 27.768192 13.279222) (xy 27.653454 13.355887) (xy 26.105888 14.903453) (xy 26.105885 14.903457)
|
||||
(xy 26.043173 14.997313) (xy 25.989561 15.042118) (xy 25.952674 15.05178) (xy 25.872202 15.060001)
|
||||
(xy 25.8722 15.060001) (xy 25.705668 15.115185) (xy 25.705663 15.115187) (xy 25.556342 15.207289)
|
||||
(xy 25.497681 15.265951) (xy 25.436358 15.299436) (xy 25.366666 15.294452) (xy 25.310733 15.25258)
|
||||
(xy 25.286316 15.187116) (xy 25.286 15.17827) (xy 25.286 14.237018) (xy 25.305685 14.169979) (xy 25.322314 14.149342)
|
||||
(xy 27.171655 12.300001) (xy 35.877704 12.300001) (xy 35.877899 12.302486) (xy 35.923718 12.460198)
|
||||
(xy 36.007314 12.601552) (xy 36.007321 12.601561) (xy 36.123438 12.717678) (xy 36.123447 12.717685)
|
||||
(xy 36.264803 12.801282) (xy 36.264806 12.801283) (xy 36.422504 12.847099) (xy 36.42251 12.8471)
|
||||
(xy 36.45935 12.849999) (xy 36.459366 12.85) (xy 36.8625 12.85) (xy 36.8625 12.3) (xy 35.877705 12.3)
|
||||
(xy 35.877704 12.300001) (xy 27.171655 12.300001) (xy 27.671658 11.799998) (xy 35.877704 11.799998)
|
||||
(xy 35.877705 11.8) (xy 36.8625 11.8) (xy 37.3625 11.8) (xy 38.347295 11.8) (xy 38.347295 11.799998)
|
||||
(xy 38.3471 11.797513) (xy 38.301281 11.639801) (xy 38.217685 11.498447) (xy 38.217678 11.498438)
|
||||
(xy 38.101561 11.382321) (xy 38.101552 11.382314) (xy 37.960196 11.298717) (xy 37.960193 11.298716)
|
||||
(xy 37.802495 11.2529) (xy 37.802489 11.252899) (xy 37.765649 11.25) (xy 37.3625 11.25) (xy 37.3625 11.8)
|
||||
(xy 36.8625 11.8) (xy 36.8625 11.25) (xy 36.45935 11.25) (xy 36.42251 11.252899) (xy 36.422504 11.2529)
|
||||
(xy 36.264806 11.298716) (xy 36.264803 11.298717) (xy 36.123447 11.382314) (xy 36.123438 11.382321)
|
||||
(xy 36.007321 11.498438) (xy 36.007314 11.498447) (xy 35.923718 11.639801) (xy 35.877899 11.797513)
|
||||
(xy 35.877704 11.799998) (xy 27.671658 11.799998) (xy 32.102079 7.369576) (xy 32.1634 7.336093)
|
||||
(xy 32.233092 7.341077) (xy 32.246047 7.346772) (xy 32.247588 7.347557) (xy 32.449757 7.413246)
|
||||
(xy 32.659713 7.4465) (xy 32.659714 7.4465) (xy 32.872286 7.4465) (xy 32.872287 7.4465) (xy 33.082243 7.413246)
|
||||
(xy 33.284412 7.347557) (xy 33.473816 7.251051) (xy 33.560138 7.188335) (xy 33.645786 7.126109)
|
||||
(xy 33.645788 7.126106) (xy 33.645792 7.126104) (xy 33.796104 6.975792) (xy 33.796106 6.975788)
|
||||
(xy 33.796109 6.975786) (xy 33.863515 6.883007) (xy 33.921051 6.803816) (xy 33.925793 6.794508)
|
||||
(xy 33.973763 6.743711) (xy 34.041583 6.726911) (xy 34.107719 6.749445) (xy 34.146763 6.7945) (xy 34.151373 6.803547)
|
||||
(xy 34.190728 6.857716) (xy 34.823037 6.225408) (xy 34.840075 6.288993) (xy 34.905901 6.403007)
|
||||
(xy 34.998993 6.496099) (xy 35.113007 6.561925) (xy 35.17659 6.578962) (xy 34.544282 7.211269) (xy 34.544282 7.21127)
|
||||
(xy 34.598449 7.250624) (xy 34.787782 7.347095) (xy 34.98987 7.412757) (xy 35.199754 7.446) (xy 35.412246 7.446)
|
||||
(xy 35.622127 7.412757) (xy 35.62213 7.412757) (xy 35.824217 7.347095) (xy 36.013554 7.250622) (xy 36.067716 7.21127)
|
||||
(xy 36.067717 7.21127) (xy 35.435408 6.578962) (xy 35.498993 6.561925) (xy 35.613007 6.496099) (xy 35.706099 6.403007)
|
||||
(xy 35.771925 6.288993) (xy 35.788962 6.225408)
|
||||
)
|
||||
)
|
||||
(filled_polygon
|
||||
@@ -5247,9 +5248,9 @@
|
||||
(xy 3.205739 44.177256) (xy 3.205733 44.177263) (xy 3.058067 44.369706) (xy 2.936777 44.579785)
|
||||
(xy 2.936773 44.579794) (xy 2.843947 44.803895) (xy 2.781161 45.038214) (xy 2.7495 45.278711) (xy 0.5005 45.278711)
|
||||
(xy 0.5005 13.871153) (xy 2.9495 13.871153) (xy 2.9495 30.253846) (xy 2.980261 30.408489) (xy 2.980264 30.408501)
|
||||
(xy 3.040602 30.554172) (xy 3.040609 30.554185) (xy 3.12821 30.685288) (xy 3.128213 30.685292) (xy 4.424707 31.981786)
|
||||
(xy 4.424711 31.981789) (xy 4.555814 32.06939) (xy 4.555827 32.069397) (xy 4.701498 32.129735) (xy 4.701503 32.129737)
|
||||
(xy 4.856153 32.160499) (xy 4.856156 32.1605) (xy 4.856158 32.1605) (xy 5.013842 32.1605) (xy 6.215106 32.1605)
|
||||
(xy 3.040602 30.554172) (xy 3.040609 30.554185) (xy 3.12821 30.685288) (xy 3.128213 30.685292) (xy 4.313211 31.870289)
|
||||
(xy 4.385632 31.94271) (xy 4.424712 31.98179) (xy 4.555814 32.06939) (xy 4.555827 32.069397) (xy 4.701498 32.129735)
|
||||
(xy 4.701503 32.129737) (xy 4.856153 32.160499) (xy 4.856156 32.1605) (xy 4.856158 32.1605) (xy 6.215106 32.1605)
|
||||
(xy 6.246396 32.169687) (xy 6.278032 32.177653) (xy 6.280186 32.179609) (xy 6.282145 32.180185)
|
||||
(xy 6.305585 32.199709) (xy 6.310876 32.205355) (xy 6.335896 32.239792) (xy 6.451244 32.35514) (xy 6.452616 32.356604)
|
||||
(xy 6.467485 32.386069) (xy 6.483303 32.415037) (xy 6.483154 32.417118) (xy 6.484094 32.418981)
|
||||
@@ -5280,16 +5281,16 @@
|
||||
(xy 11.998503 34.551737) (xy 11.998507 34.551737) (xy 11.998508 34.551738) (xy 12.153154 34.5825)
|
||||
(xy 12.153157 34.5825) (xy 12.153158 34.5825) (xy 23.9675 34.5825) (xy 24.034539 34.602185) (xy 24.080294 34.654989)
|
||||
(xy 24.0915 34.7065) (xy 24.0915 43.020846) (xy 24.122261 43.175489) (xy 24.122264 43.175501) (xy 24.182602 43.321172)
|
||||
(xy 24.182609 43.321185) (xy 24.27021 43.452288) (xy 24.270213 43.452292) (xy 26.357707 45.539786)
|
||||
(xy 26.357711 45.539789) (xy 26.488814 45.62739) (xy 26.488827 45.627397) (xy 26.634498 45.687735)
|
||||
(xy 26.634503 45.687737) (xy 26.789153 45.718499) (xy 26.789156 45.7185) (xy 26.789158 45.7185)
|
||||
(xy 26.946842 45.7185) (xy 28.461267 45.7185) (xy 28.528306 45.738185) (xy 28.574061 45.790989)
|
||||
(xy 24.182609 43.321185) (xy 24.27021 43.452288) (xy 24.270213 43.452292) (xy 26.246211 45.428289)
|
||||
(xy 26.33921 45.521288) (xy 26.357712 45.53979) (xy 26.488814 45.62739) (xy 26.488827 45.627397)
|
||||
(xy 26.634498 45.687735) (xy 26.634503 45.687737) (xy 26.789153 45.718499) (xy 26.789156 45.7185)
|
||||
(xy 26.789158 45.7185) (xy 28.461267 45.7185) (xy 28.528306 45.738185) (xy 28.574061 45.790989)
|
||||
(xy 28.578972 45.803494) (xy 28.590186 45.837334) (xy 28.682288 45.986656) (xy 28.806344 46.110712)
|
||||
(xy 28.955666 46.202814) (xy 29.122203 46.257999) (xy 29.224991 46.2685) (xy 30.775008 46.268499)
|
||||
(xy 30.877797 46.257999) (xy 31.044334 46.202814) (xy 31.193656 46.110712) (xy 31.317712 45.986656)
|
||||
(xy 31.409814 45.837334) (xy 31.421028 45.803494) (xy 31.460801 45.74605) (xy 31.525317 45.719228)
|
||||
(xy 31.538733 45.7185) (xy 34.916844 45.7185) (xy 34.916845 45.718499) (xy 35.071497 45.687737)
|
||||
(xy 35.217179 45.627394) (xy 35.348289 45.539789) (xy 35.36679 45.521288) (xy 35.609368 45.278711)
|
||||
(xy 35.217179 45.627394) (xy 35.348289 45.539789) (xy 35.459789 45.428289) (xy 35.609368 45.278711)
|
||||
(xy 43.5495 45.278711) (xy 43.5495 45.521288) (xy 43.581161 45.761785) (xy 43.643947 45.996104)
|
||||
(xy 43.736773 46.220205) (xy 43.736776 46.220212) (xy 43.858064 46.430289) (xy 43.858066 46.430292)
|
||||
(xy 43.858067 46.430293) (xy 44.005733 46.622736) (xy 44.005739 46.622743) (xy 44.177256 46.79426)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
"lockedItems": false,
|
||||
"otherItems": false,
|
||||
"pads": false,
|
||||
"text": false,
|
||||
"tracks": true,
|
||||
"text": true,
|
||||
"tracks": false,
|
||||
"vias": false,
|
||||
"zones": false
|
||||
},
|
||||
|
||||
@@ -585,12 +585,24 @@
|
||||
"label": "Datasheet",
|
||||
"name": "Datasheet",
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "Description",
|
||||
"name": "Description",
|
||||
"show": false
|
||||
},
|
||||
{
|
||||
"group_by": false,
|
||||
"label": "#",
|
||||
"name": "${ITEM_NUMBER}",
|
||||
"show": false
|
||||
}
|
||||
],
|
||||
"filter_string": "",
|
||||
"group_symbols": true,
|
||||
"include_excluded_from_bom": true,
|
||||
"name": "Default Editing",
|
||||
"name": "",
|
||||
"sort_asc": true,
|
||||
"sort_field": "Reference"
|
||||
},
|
||||
|
||||
36
Readme.md
36
Readme.md
@@ -17,7 +17,7 @@ Designed in **KiCad v9**.
|
||||
3. [Panel Design and GCode](#panel-design-and-gcode)
|
||||
4. [Microcontroller Pin Mapping](#microcontroller-pin-mapping)
|
||||
5. [Firmware Logic](#firmware-logic)
|
||||
6. [Development & Programming](#development--programming)
|
||||
6. [Firmware Build & Flashing](#firmware-build--flashing)
|
||||
|
||||
## Features
|
||||
* **Microcontroller:** WCH CH32V003J4M6 (RISC-V).
|
||||
@@ -36,24 +36,28 @@ Designed in **KiCad v9**.
|
||||
The [scripts](scripts) folder contains a guide to panelize the board (`Flow_Controller_Panel.kicad_pcb`) and howto generate gcode.
|
||||
|
||||
## Microcontroller Pin Mapping (Per Schematic)
|
||||
| Pin | Schematic Net | Function |
|
||||
| :--- | :--- | :--- |
|
||||
| 1 | `FLOW_PULSE_MCU` | Input: Pulse counter from Flow Sensor (via RC Filter) |
|
||||
| 2 | `GND` | System Ground (VSS) |
|
||||
| 3 | `ALARM_TRIGGER` | Output: Drives the Gate of the 2N7002 MOSFET |
|
||||
| 4 | `+5V` | System Power (VDD) |
|
||||
| 5 | `I2C_SDA` | I2C Data (OLED Display) |
|
||||
| 6 | `I2C_SCL` | I2C Clock (OLED Display) |
|
||||
| 7 | `BUTTON_ADC` | ADC Input: 2-Button Resistor Ladder |
|
||||
| 8 | `SWIO` | WCH-LinkE Programming Interface |
|
||||
| Pin | Schematic Net | Function | MCU Port (SOP8) |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| 1 | `FLOW_PULSE_MCU` | Input: Pulse counter from Flow Sensor | PD6 |
|
||||
| 2 | `GND` | System Ground (VSS) | VSS |
|
||||
| 3 | `ALARM_TRIGGER` | Output: Drives the Gate of the 2N7002 | PA2 |
|
||||
| 4 | `+5V` | System Power (VDD) | VDD |
|
||||
| 5 | `I2C_SDA` | I2C Data (OLED Display) | PC1 |
|
||||
| 6 | `I2C_SCL` | I2C Clock (OLED Display) | PC2 |
|
||||
| 7 | `BUTTON_ADC` | ADC Input: 2-Button Resistor Ladder | PC4 |
|
||||
| 8 | `SWIO` | WCH-LinkE Programming Interface | PD1 |
|
||||
|
||||
## Firmware Logic (Overview)
|
||||
1. **Interrupts:** Pin 1 counts falling edges from the flow sensor. Flow (L/min) is calculated every second.
|
||||
1. **Interrupts:** Pin 1 (PD6) counts falling edges from the flow sensor. Flow (L/min) is calculated every second.
|
||||
2. **Failsafe:** If `Current_Flow >= Threshold`, Pin 3 is driven **HIGH** (MOSFET ON, CNC OK). If `Current_Flow < Threshold`, Pin 3 is driven **LOW** (MOSFET OFF, CNC Alarm).
|
||||
3. **UI:** ADC reads Pin 7 to detect button presses for adjusting the threshold.
|
||||
3. **UI:** ADC reads Pin 7 (PC4) to detect button presses for adjusting the threshold.
|
||||
4. **Storage:** User-defined threshold is saved to MCU flash memory.
|
||||
|
||||
## Development & Programming
|
||||
To flash the CH32V003, you will need a **WCH-LinkE** programmer connected to the 3-pin SWIO header `J1` (+5V, SWIO, GND).
|
||||
|
||||
## Firmware Build & Flashing
|
||||
The firmware is written in C using the lightweight `ch32fun` framework. All source files and toolchain documentation are located in the `firmware` folder.
|
||||
|
||||
**Step-by-step Setup:**
|
||||
1. Follow the setup guide in [`firmware/Readme.md`](firmware/Readme.md) to install the RISC-V GCC toolchain and `minichlink`.
|
||||
2. Connect your **WCH-LinkE** programmer to the 3-pin SWIO header `J1` (+5V, SWIO, GND).
|
||||
3. Run `make` to compile the firmware.
|
||||
4. Run `make flash` to upload the code to the CH32V003 microcontroller.
|
||||
15
firmware/.gitignore
vendored
Normal file
15
firmware/.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Compiled binaries
|
||||
*.elf
|
||||
*.bin
|
||||
*.hex
|
||||
|
||||
# Build artifacts and memory maps
|
||||
*.map
|
||||
*.o
|
||||
*.d
|
||||
*.lst
|
||||
|
||||
# Specifically ignore the output files for our target
|
||||
main.elf
|
||||
main.bin
|
||||
main.map
|
||||
12
firmware/Makefile
Normal file
12
firmware/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
all : flash
|
||||
|
||||
TARGET:=main
|
||||
TARGET_MCU:=CH32V003
|
||||
|
||||
# Path based on your error output
|
||||
CH32FUN:=/home/martin/ch32fun/ch32fun
|
||||
|
||||
include $(CH32FUN)/ch32fun.mk
|
||||
|
||||
flash : cv_flash
|
||||
clean : cv_clean
|
||||
80
firmware/Readme.md
Normal file
80
firmware/Readme.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# CH32V003 Firmware & Linux Development Setup
|
||||
|
||||
This folder contains the firmware source code for the CNC Water Flow Controller, built using the [ch32fun](https://github.com/cnlohr/ch32fun) framework.
|
||||
|
||||
Below is the guide to set up the build environment, compile, and flash the CH32V003 series on Linux using CLI tools.
|
||||
|
||||
*Tested on: Ubuntu Linux, CH32V003J4M6 (8-pin)*
|
||||
|
||||
---
|
||||
|
||||
## 1. Install toolchain
|
||||
|
||||
Download xPack RISC-V GCC:
|
||||
[https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases)
|
||||
|
||||
Extract it:
|
||||
```bash
|
||||
mkdir -p ~/toolchains
|
||||
tar -xzf xpack-riscv-none-elf-gcc-*-linux-x64.tar.gz -C ~/toolchains
|
||||
```
|
||||
|
||||
Activate it (add this to your ~/.bashrc for permanence):
|
||||
```Bash
|
||||
export TOOLCHAIN=$HOME/toolchains/xpack-riscv-none-elf-gcc-* # Update e.g.: xpack-riscv-none-elf-gcc-15.2.0-1
|
||||
export PATH=$TOOLCHAIN/bin:$PATH
|
||||
```
|
||||
|
||||
Verify the installation:
|
||||
```Bash
|
||||
riscv-none-elf-gcc --version
|
||||
```
|
||||
|
||||
## 2. Install Flashing Tool (minichlink)
|
||||
Clone the ch32fun repository and build minichlink:
|
||||
```Bash
|
||||
git clone https://github.com/cnlohr/ch32fun ~/ch32fun
|
||||
cd ~/ch32fun/minichlink
|
||||
make
|
||||
sudo mv minichlink /usr/local/bin/
|
||||
```
|
||||
|
||||
## 3. Build the Firmware
|
||||
Navigate to this firmware directory where the Makefile and main.c are located. Make sure the CH32FUN path in the Makefile points to where you cloned ch32fun.
|
||||
```Bash
|
||||
cd Flow-Controller/firmware
|
||||
make clean
|
||||
make
|
||||
```
|
||||
This will generate main.bin and main.elf.
|
||||
|
||||
## 4. Flash Firmware
|
||||
Connect your WCH-LinkE programmer to the board's J1 header:
|
||||
| Signal | Programmer | MCU Header (J1) |
|
||||
| :--- | :--- | :--- |
|
||||
| SWIO | SWDIO | Pin 3 (SWIO) |
|
||||
| GND | GND | Pin 2 (GND) |
|
||||
| 5V | 3.3V | Pin 1 (+3.3V) |
|
||||
Flash the compiled binary:
|
||||
```Bash
|
||||
make flash
|
||||
```
|
||||
or manually:
|
||||
```bash
|
||||
minichlink -w main.bin flash
|
||||
```
|
||||
|
||||
## 5. Logs
|
||||
See logs on the SWIO pin:
|
||||
```Bash
|
||||
minichlink -T
|
||||
```
|
||||
|
||||
## 6. Unbricking
|
||||
If you accidentally misconfigure the SWIO pin and lock yourself out, you can use the CH32V003 Unbrick CLI tool:
|
||||
```Bash
|
||||
git clone https://github.com/shakir-abdo/ch32v003-unbrick.git
|
||||
cd ch32v003-unbrick
|
||||
npm install
|
||||
./unbrick.js
|
||||
```
|
||||
13
firmware/funconfig.h
Normal file
13
firmware/funconfig.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _FUNCONFIG_H
|
||||
#define _FUNCONFIG_H
|
||||
|
||||
#define CH32V003 1
|
||||
|
||||
// Default system clock to 48MHz
|
||||
#define FUNCONF_SYSTEM_CORE_CLOCK 48000000
|
||||
|
||||
// support "printf-over-single-wire" at about 400kBaud on the SWIO pin (PD1)
|
||||
#define FUNCONF_USE_DEBUGPRINTF 1
|
||||
#define FUNCONF_USE_UARTPRINTF 0
|
||||
|
||||
#endif // _FUNCONFIG_H
|
||||
169
firmware/main.c
Normal file
169
firmware/main.c
Normal file
@@ -0,0 +1,169 @@
|
||||
#include "ch32fun.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// ==========================================
|
||||
// PIN CONFIGURATION (CH32V003J4M6 - SOP8)
|
||||
// ==========================================
|
||||
// Package Pin 1: PD6 (FLOW_PULSE_MCU) -> EXTI Input
|
||||
// Package Pin 3: PA2 (ALARM_TRIGGER) -> GPIO Output
|
||||
// Package Pin 5: PC1 (I2C_SDA) -> Bitbang or HW I2C
|
||||
// Package Pin 6: PC2 (I2C_SCL) -> Bitbang or HW I2C
|
||||
// Package Pin 7: PC4 (BUTTON_ADC) -> ADC Channel 2 Input
|
||||
// Package Pin 8: PD1 (SWIO) -> Programming & Logging
|
||||
|
||||
#define FLOW_PIN 6 // PD6 = bit 6 of GPIOD
|
||||
#define ALARM_PIN 2 // PA2 = bit 2 of GPIOA
|
||||
#define BUTTON_PIN 4 // PC4 = bit 4 of GPIOC
|
||||
|
||||
// Constants
|
||||
#define FLOW_CONVERSION_FACTOR 5.5 // L/min = Hz / 5.5 (Adjust for ZJ-S401)
|
||||
|
||||
#define ADC_UP_BTN_MAX 200 // Button 1 range: 50..200 (center ~93)
|
||||
#define ADC_UP_BTN_MIN 20
|
||||
#define ADC_DOWN_BTN_MAX 15 // Button 2 range: 0..15 (should read ~0)
|
||||
|
||||
#define DEBOUNCE_DELAY_MS 200
|
||||
|
||||
// Globals
|
||||
volatile uint32_t pulse_count = 0;
|
||||
uint32_t flow_rate_ml_min = 0; // Stored in mL/min for integer precision
|
||||
uint32_t threshold_ml_min = 2000; // Default: 2.0 L/min
|
||||
uint8_t alarm_active = 0; // Track state to prevent log spam (0 = OK, 1 = ALARM)
|
||||
|
||||
// ==========================================
|
||||
// INTERRUPT HANDLER (Flow Sensor Pulses)
|
||||
// ==========================================
|
||||
void EXTI7_0_IRQHandler(void) __attribute__((interrupt));
|
||||
void EXTI7_0_IRQHandler(void) {
|
||||
if (EXTI->INTFR & (1 << FLOW_PIN)) {
|
||||
pulse_count++;
|
||||
EXTI->INTFR = (1 << FLOW_PIN); // Clear interrupt flag
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// HARDWARE INITIALIZATION
|
||||
// ==========================================
|
||||
void Init_Hardware(void) {
|
||||
// 1. Enable Clocks for GPIOA, GPIOC, GPIOD, ADC, AFIO
|
||||
RCC->APB2PCENR |= RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_ADC1 | RCC_APB2Periph_AFIO;
|
||||
|
||||
// 2. Configure ALARM_TRIGGER Output (PA2) - Push-Pull
|
||||
GPIOA->CFGLR &= ~(0xF << (4 * ALARM_PIN));
|
||||
GPIOA->CFGLR |= (GPIO_Speed_10MHz | GPIO_CNF_OUT_PP) << (4 * ALARM_PIN);
|
||||
GPIOA->BSHR = (1 << (16 + ALARM_PIN)); // Default to ALARM STATE (Low = MOSFET OFF)
|
||||
|
||||
// 3. Configure FLOW_PULSE_MCU Input (PD6) - Pull-up
|
||||
GPIOD->CFGLR &= ~(0xF << (4 * FLOW_PIN));
|
||||
GPIOD->CFGLR |= (GPIO_CNF_IN_PUPD) << (4 * FLOW_PIN);
|
||||
GPIOD->BSHR = (1 << FLOW_PIN); // Enable pull-up
|
||||
|
||||
// Setup EXTI on PD6 (CH32V003 has single EXTICR, 2 bits per pin, Port D = 0b11)
|
||||
AFIO->EXTICR |= (0b11 << (FLOW_PIN * 2)); // PD6: Port D=0b11, bits [13:12]
|
||||
EXTI->INTENR |= (1 << FLOW_PIN); // Enable EXTI interrupt on line 6
|
||||
EXTI->FTENR |= (1 << FLOW_PIN); // Falling edge trigger
|
||||
NVIC_EnableIRQ(EXTI7_0_IRQn); // Enable interrupt in NVIC
|
||||
|
||||
// 4. Configure BUTTON_ADC Input (PC4 / AIN2) - Analog mode (no pull)
|
||||
GPIOC->CFGLR &= ~(0xF << (4 * BUTTON_PIN));
|
||||
|
||||
// Setup ADC
|
||||
ADC1->CTLR2 |= ADC_ADON; // Turn on ADC
|
||||
ADC1->RSQR3 = 2; // PC4 is ADC Channel 2 (AIN2)
|
||||
ADC1->SAMPTR2 = 7 << (3 * 2); // Max sampling time for CH2
|
||||
|
||||
ADC1->CTLR2 |= ADC_RSTCAL; // Reset & calibrate
|
||||
while(ADC1->CTLR2 & ADC_RSTCAL);
|
||||
ADC1->CTLR2 |= ADC_CAL;
|
||||
while(ADC1->CTLR2 & ADC_CAL);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// HELPER FUNCTIONS
|
||||
// ==========================================
|
||||
uint16_t Read_ADC(void) {
|
||||
ADC1->CTLR2 |= ADC_SWSTART;
|
||||
while(!(ADC1->STATR & ADC_EOC));
|
||||
return ADC1->RDATAR;
|
||||
}
|
||||
|
||||
void Update_Display(uint32_t current_flow, uint32_t threshold) {
|
||||
// TODO: Implement OLED I2C drawing here using ch32fun's I2C bitbang
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// MAIN LOOP
|
||||
// ==========================================
|
||||
int main() {
|
||||
SystemInit();
|
||||
Init_Hardware();
|
||||
|
||||
printf("\r\n==================================\r\n");
|
||||
printf(" CNC Flow Controller Initialized\r\n");
|
||||
printf("==================================\r\n");
|
||||
printf("[INFO] Active Threshold: %lu mL/min\r\n", threshold_ml_min);
|
||||
|
||||
uint32_t last_time = SysTick->CNT;
|
||||
uint32_t last_button_time = 0;
|
||||
|
||||
while(1) {
|
||||
uint32_t current_time = SysTick->CNT;
|
||||
uint32_t ticks_per_sec = DELAY_US_TIME * 1000000; // = FUNCONF_SYSTEM_CORE_CLOCK
|
||||
|
||||
// --- 1. EVALUATE FLOW EVERY 1 SECOND ---
|
||||
if ((current_time - last_time) >= ticks_per_sec) {
|
||||
last_time = current_time;
|
||||
|
||||
// Copy and reset pulse count safely
|
||||
NVIC_DisableIRQ(EXTI7_0_IRQn);
|
||||
uint32_t hz = pulse_count;
|
||||
pulse_count = 0;
|
||||
NVIC_EnableIRQ(EXTI7_0_IRQn);
|
||||
|
||||
// Calculate Flow: L/min = Hz / 5.5 => mL/min = (Hz * 10000) / 55
|
||||
flow_rate_ml_min = (hz * 10000) / 55;
|
||||
|
||||
// --- 2. FAILSAFE LOGIC & LOGGING ---
|
||||
if (flow_rate_ml_min >= threshold_ml_min) {
|
||||
// Flow OK -> Drive ALARM_PIN High (MOSFET ON, CNC OK)
|
||||
GPIOA->BSHR = (1 << ALARM_PIN);
|
||||
|
||||
if (alarm_active == 1) {
|
||||
alarm_active = 0;
|
||||
printf("[INFO] Flow restored: %lu mL/min. Alarm CLEARED.\r\n", flow_rate_ml_min);
|
||||
}
|
||||
} else {
|
||||
// Flow Low -> Drive ALARM_PIN Low (MOSFET OFF, CNC Alarm)
|
||||
GPIOA->BSHR = (1 << (16 + ALARM_PIN));
|
||||
|
||||
if (alarm_active == 0) {
|
||||
alarm_active = 1;
|
||||
printf("[WARN] Low flow detected: %lu mL/min (Thr: %lu). Alarm TRIGGERED!\r\n", flow_rate_ml_min, threshold_ml_min);
|
||||
}
|
||||
}
|
||||
|
||||
Update_Display(flow_rate_ml_min, threshold_ml_min);
|
||||
}
|
||||
|
||||
// --- 3. BUTTON HANDLING (ADC Resistor Ladder) ---
|
||||
// Thresholds match actual voltages: no-press ~1023, BTN1 ~93, BTN2 ~0.
|
||||
uint16_t adc_val = Read_ADC();
|
||||
|
||||
if ((current_time - last_button_time) > (DEBOUNCE_DELAY_MS * DELAY_US_TIME * 1000)) {
|
||||
if (adc_val >= ADC_UP_BTN_MIN && adc_val <= ADC_UP_BTN_MAX) {
|
||||
// Button 1: voltage divider 10k+1k -> ~0.30V -> ADC ~93
|
||||
threshold_ml_min += 100;
|
||||
last_button_time = current_time;
|
||||
printf("[SET] Threshold increased to: %lu mL/min\r\n", threshold_ml_min);
|
||||
Update_Display(flow_rate_ml_min, threshold_ml_min);
|
||||
}
|
||||
else if (adc_val <= ADC_DOWN_BTN_MAX) {
|
||||
// Button 2: direct to GND -> ~0V -> ADC ~0
|
||||
if (threshold_ml_min >= 100) threshold_ml_min -= 100;
|
||||
last_button_time = current_time;
|
||||
printf("[SET] Threshold decreased to: %lu mL/min\r\n", threshold_ml_min);
|
||||
Update_Display(flow_rate_ml_min, threshold_ml_min);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 415 KiB |
BIN
scripts/panel/Flow_Controller_Panel-Back.pdf
Normal file
BIN
scripts/panel/Flow_Controller_Panel-Back.pdf
Normal file
Binary file not shown.
10310
scripts/panel/Flow_Controller_Panel-Back.svg
Normal file
10310
scripts/panel/Flow_Controller_Panel-Back.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 166 KiB |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 157 KiB |
@@ -50,7 +50,7 @@
|
||||
"conflict_shadows",
|
||||
"shapes"
|
||||
],
|
||||
"visible_layers": "fffffff_ffffffff",
|
||||
"visible_layers": "00000000_00000000_0fffffff_fffffffe",
|
||||
"zone_display_mode": 0
|
||||
},
|
||||
"git": {
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
"version": 4
|
||||
},
|
||||
"net_colors": null,
|
||||
"netclass_assignments": {},
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": [
|
||||
{
|
||||
"netclass": "Board_0-Default",
|
||||
|
||||
Reference in New Issue
Block a user