-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WIDGETS/Graphs/main.lua to support HORUS platforms
- still lots of todos Update GRAPHS/graphs.lua - function init(id): clears `graphs` table, clears `graphs` item by id Update GRAPHS/graphs.lua - set table `graphs` global Update Graph/main.lua Update WIDGETS/Graph/main.lua - put options and config tables in extra files Update WIDGETS/Graph/main.lua - replace param `style` with `lnStyle` - add param `lnSize` for line thickness Update WIDGETS/graph.lua - replace param `style` with `lnStyle` - add param `lnSize` for line thickness Update memgph.lua - add mem used kByte value Update TELEMETRY screens - replace param `style` with `lnStyle` - add param `lnSize` for line thickness Update GRAPHS/graphs.lua - add param `lnSize` for line thickness Update README.md Update build files
- Loading branch information
1 parent
4e014b8
commit a41c844
Showing
9 changed files
with
163 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
return { | ||
lbl="", | ||
lblstyle=SMLSIZE+INVERS, | ||
unit="", | ||
crit=nil, | ||
-- lnStyle=DOTTED, | ||
lnSize=2, | ||
p={ t=0,r=0,b=0,l=0 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--[[ ** TELEMETRY SCREEN WIDGET ** | ||
Draws a moving line graph from a given source. | ||
PLATFORM | ||
HORUS and relatives | ||
SCALING | ||
vert: scalable | ||
horiz: scalable | ||
OPTIONS [options.lua] | ||
UID: int | ||
- Systemwide unique graph ID | ||
Speed: int (optional, default 30) | ||
- Running speed in 100ths second intervals, means smaller is faster | ||
Min/Max: number | ||
- Largest/smallest possible value | ||
Source: number | ||
- Input sensor-ID | ||
PARAMETER [config.lua] | ||
lbl: string (optional) | ||
- Widgets label text at the top | ||
lblstyle: int (optional, default 0) | ||
- Set text attributes for label | ||
unit: string (optional) | ||
- Unit sign drawn behind the value | ||
- Set to "%", to output percent of 'src', calculated with 'min' and 'max' | ||
crit: number (optional) | ||
- If set, the line style is DOTTED below and SOLID above this value | ||
- The X-axis gets a mark at the values position | ||
lnStyle: int (optional, default SOLID - but DOTTED at 'min' or 'max' values) | ||
- Set to SOLID for a full solid line | ||
- Set to DOTTED for a dotted line | ||
lnSize: int (optional, default 1) | ||
- Set the line thickness in px | ||
p: table (optional, default [t=0, r=0, b=0, l=0]) | ||
- Cell padding in px | ||
(top, right, bottom, left) | ||
--]] | ||
|
||
local options = assert(loadScript("/WIDGETS/Graph/options.lua"))() | ||
|
||
local function create(zone, options) | ||
local cfg = assert(loadScript("/WIDGETS/Graph/config.lua"))() | ||
local core = assert(loadScript("/SCRIPTS/GRAPHS/graphs.lua"))() | ||
core.init() | ||
|
||
return { zone=zone, options=options, cfg=cfg, core=core } | ||
end | ||
|
||
local function update(wgt, options) | ||
wgt.options = options | ||
wgt.core.init(options.UID) | ||
|
||
return wgt | ||
end | ||
|
||
local function background(wgt) | ||
return wgt.core.run() | ||
end | ||
|
||
function refresh(wgt) | ||
local cfg = wgt.cfg | ||
|
||
wgt.core.run() | ||
|
||
if cfg.lbl then | ||
local val = getValue(wgt.options.Source) | ||
lcd.drawText(wgt.zone.x + 1, wgt.zone.y + 1, cfg.lbl .. " " .. val .. (cfg.unit or ""), cfg.lblstyle) | ||
cfg.p.t = 21 | ||
end | ||
|
||
createGraph(wgt.options.UID, { | ||
src=wgt.options.Source, | ||
x=wgt.zone.x + cfg.p.l, | ||
y=wgt.zone.y + cfg.p.t, | ||
w=wgt.zone.w - cfg.p.l - cfg.p.r, | ||
h=wgt.zone.h - cfg.p.t - cfg.p.b, | ||
speed=wgt.options.Speed, | ||
min=wgt.options.Min, | ||
max=wgt.options.Max, | ||
lnStyle=cfg.lnStyle, | ||
lnSize=cfg.lnSize, | ||
crit=cfg.crit | ||
}) | ||
end | ||
|
||
return { name="THR Curve", options=options, create=create, update=update, background=background, refresh=refresh } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
return { | ||
{ "UID", VALUE, 1, 1, 99 }, | ||
{ "Speed", VALUE, 30, 1, 999 }, | ||
{ "Min", VALUE, -1024, -1024, 1024 }, | ||
{ "Max", VALUE, 1024, -1024, 1024 }, | ||
{ "Source", SOURCE, 1 }, | ||
} |