Skip to content

Commit

Permalink
Scripts in user_config_override_*.h changed for Covid-CO2 v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnold-n committed Jan 6, 2021
1 parent d3e3368 commit 7f4c19f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions tasmota/user_config_override_MHZ19B_ABC_disabled.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ Examples :
#define MHZ19B_ABC_DISABLE

// Script for MHZ19B:
#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=MHZ19B#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower1 0\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower1 0\n} else {\n=>LedPower1 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"
#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=MHZ19B#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower 0\n=>SetOption31 1\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower 0\n} else {\n=>LedPower 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"

// Script for S8:
//#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=S8#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower1 0\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower1 0\n} else {\n=>LedPower1 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"
//#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=S8#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower 0\n=>SetOption31 1\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower 0\n} else {\n=>LedPower 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"

// Script for SCD-30:
//#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=SCD30#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower1 0\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower1 0\n} else {\n=>LedPower1 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"
//#define PRECONFIGURED_SCRIPT ">D\n; CO2 sensor script for covid-CO2 project\n; (c) Arnold Niessen license CC BY-SA 4.0\n\n; configuration parameters:\n; g1 is CO2 threshold line\n; mx is max CO2 value in graph\n; g1+g2+mx determine LED blinking\n; Bmin,Bmax ADC values for battery display\n; tstep is graph update cycle: 30s/pixel = 1 hour cycle\n; h is stepsize dashed line\n\ng1=600\ng2=800\nmx=1000\ntstep=30\nh=4\nblnk=0\nbmin=640\nbmax=1024\n\n; other vars:\n; a,aa for battery image\n; x,x2 is graph position on graph (0..127)\n; t is time of most recent graph update (in seconds)\n; l is CO2 value\n; ft 1:first-time init; 2: wait for usefule readings\n\na=0\naa=0\nx=0\nx2=0\nt=0\nl=0\nft=1\ny=1\nftn=0\n\n>T\n; Select sensor: S8 or MHZ19B or SCD30\nl=SCD30#CarbonDioxide\n\n; first time: initialize display\nif ft==1 {\n=>Power on\n=>LedPower 0\n=>SetOption31 1\n=>DisplayMode 0\ny=(g1-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\nfor ftn 0 127 h\n=>DisplayText [C1x%0ftn%y%0y%v1]\nnext\nft=2\n}\n\n; do not print initial 0 or 410 values of sensor (for MHZ)\nif (((l>0) and (l!=410)) or (upsecs>120)) {\nft=0\n}\n\n; print CO2 ppm value as text\nif ft>0 {\n=>DisplayText [x-2y43C1f2] ---\n=>DisplayText [x66y41C1]ppm\nif (adc(7)>500) {\n; draw battery\n=>DisplayText [C1x120y42h7]\n=>DisplayText [C1x120y63h7]\n=>DisplayText [C1x120y43v20]\n=>DisplayText [C1x127y43v20]\n}\n} else {\nif l<1000 {\n=>DisplayText [x-2y43C1f2] %0l%\n} else {\n=>DisplayText [x-2y43C1f2]%0l%\n}\n=>DisplayText [x66y41C1]ppm\n\na=adc(7)\nif a>500 {\na=18*(a-bmin)/(bmax-bmin)\nif (a<1) {\na=1\n}\nif a>18 {\na=18\n}\naa=62-a\nfor ftn 122 125 1\n=>DisplayText [C1x%0ftn%y%0aa%v%0a%]\nnext\na=18-a\nif a>0 {\nfor ftn 122 125 1\n=>DisplayText [C0x%0ftn%y44v%0a%]\nnext\n}\n}\n\n; blink LED if CO2 above thresholds g1/g2\nblnk+=1\nif blnk>2 {\nblnk=0\n}\nif ((l<=g1) or ((l<=g2) and (blnk<2)) or ((l<=mx) and (blnk<1))) {\n=>LedPower 0\n} else {\n=>LedPower 1\n}\n\n; update graph every tstep seconds\nif upsecs>t {\nt+=tstep\n\n;draw pixel for CO2 value\ny=(l-400)/(mx/40-10)\nif y<0 {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n; extend threshold line\nif x%h==0 {\ny=(g1-400)/(mx/40-10)\nif (y<0) {\ny=0\n}\nif y>=40 {\ny=40\n}\ny=40-y\n=>DisplayText [C1x%0x%y%0y%v1]\n}\n\n; clear up oldest data point\nx2=x+8\nif x2>127 {\nx2=x2-128\n}\n=>DisplayText [C0x%0x2%y0v41]\nx=x+1\nif x>=128 {\nx=0\n}\n}\n}"

// Connections used in USER_TEMPLATE:
// 288 = LED1
Expand Down
Loading

0 comments on commit 7f4c19f

Please sign in to comment.