-
Notifications
You must be signed in to change notification settings - Fork 0
/
bme280-output.fs
executable file
·92 lines (73 loc) · 2.31 KB
/
bme280-output.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Marker bme280-output.fs
defer .int
defer .float
defer .float3
defer .type
defer .cr
[undefined] /DataParms [if]
\in-system-ok begin-structure /DataParms \ For additional information about the various fields for an SVG-plot
field: >CfaDataLine \ CFA of a pointer to a field in the first record in the logfile
field: >CfaLastDataPoint \ CFA that gets the last data point in a plot.
xfield: >FirstEntry
xfield: >LastEntry
xfield: >MinStat
xfield: >MaxStat
xfield: >AverageStat
xfield: >Compression
field: >Color
end-structure
: DataItem: ( <name> -- ) \ Define an inline record for additional information.
\in-system-ok /DataParms dup here swap allot dup value swap erase ;
[then]
DataItem: &Pressure
DataItem: &Pollution
DataItem: &Temperature
DataItem: &Humidity
DataItem: &Light
: .intSpace ( n - ) (.) type space ;
: .floatSpace ( f: n - ) (f.2) type space ;
: .float3Space ( f: n - ) (f.3) type space ;
: .typeSpace ( adr cnt - ) type space ;
: .CsvSeperator ( - ) ." ;" ;
: .intCsv ( n - ) (.) type .CsvSeperator ;
: .floatCsv ( f: n - ) (f.2) type .CsvSeperator ;
: .float3Csv ( f: n - ) (f.3) type .CsvSeperator ;
: .typeCsv ( adr cnt - ) type .CsvSeperator ;
: Onscreen ( - )
['] .intSpace is .int
['] .floatSpace is .float
['] .float3Space is .float3
['] .typeSpace is .type
['] (cr) is .cr ;
Onscreen
: crCsv ( - ) crlf" type ;
: csvFormat
['] .intCsv is .int
['] .floatCsv is .float
['] .float3Csv is .float3
['] .typeCsv is .type
['] crCsv is .cr ;
ALSO HTML
: ListRecord ( i - )
4 set-precision
dup r>Date @ .int
dup r>Time @ 100 / .int
dup r>Location count .type
dup r>Pressure f@ .float
dup r>Temperature f@ .float
dup r>Humidity f@ .float
dup r>Pollution f@ .float3
r>Light f@ .float ;
PREVIOUS
: ListRecords ( vadr size interval -- )
-rot .cr s" Date time loc Press Temp Humidity" .type
nip /bme280Record / 0
do .cr i ListRecord dup +loop
drop ;
: .interval ( interval -- )
>r filename$ count r/w map-file
2dup over &bme280-FileRecords !
r> ListRecords
unmap-file ;
\ 1 .interval abort
\\\