Skip to content

Commit

Permalink
Add consomation trend gfx
Browse files Browse the repository at this point in the history
  • Loading branch information
destroyedlolo committed Sep 30, 2015
1 parent d5a4112 commit e8c2b36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 1 addition & 12 deletions Selenite/Design.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ local xoffmaxc = VBAR1 - (5 + fsdigit:StringWidth("12345"))
srf_maxconso = psrf:SubSurface( xoffmaxc, 5 + ftitle:GetHeight() + 2*ftitle1:GetHeight() + 2*fdigit:GetHeight(), fsdigit:StringWidth("12345"), HSGRPH);
srf_maxconso:SetColor( unpack(COL_DIGIT) )
srf_consogfx = psrf:SubSurface( 5, 5 + ftitle:GetHeight() + 2*ftitle1:GetHeight() + 2*fdigit:GetHeight(), xoffmaxc -5, HSGRPH)
srf_consogfx:SetColor( unpack(COL_RED) )

-----
-- Tablet
Expand Down Expand Up @@ -175,15 +176,3 @@ srf_TDehors:SetColor( unpack(COL_DIGIT) )
srf_TCave = psrf:SubSurface( VBAR1+170, goffy, 30 + fdigit:StringWidth("-888.8°C"), fdigit:GetHeight() )
srf_TCave:SetColor( unpack(COL_DIGIT) )
goffy = goffy + fdigit:GetHeight()

-- Test

psrf:SetFont( fdigit )
psrf:SetColor( unpack(COL_DIGIT) )

upddata( srf_maxconso, fsdigit, "12345" )
srf_consogfx:Clear(10,10,10,255)

-- upddata( srf_maxtpwr, fsdigit, "10.88" )
-- srf_tpwrgfx:Clear(10,10,10,255)

6 changes: 6 additions & 0 deletions Selenite/HDB.sel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ require (SELENE_SCRIPT_DIR .. "/Design")

-- Collection for graphics
dt_pwr = SelCollection.create( srf_tpwrgfx:GetWidth()/BARZOOM )
dt_conso = SelCollection.create( srf_consogfx:GetWidth()/BARZOOM )

-- Broker's stuffs
local Brk, err = SelMQTT.connect( MQTT_URL, { reliable=false, clientID=MQTT_ClientID } )
Expand All @@ -52,6 +53,11 @@ function updateConso()
local v = SelShared.get('TeleInfo/Consommation/values/PAPP')
srf_consommation:SetColor( findgradiancolor(v, cols ) )
upddata( srf_consommation, fdigit, v .. ' VA')

dt_conso:Push(v)
local min,max = dt_conso:MinMax()
upddata( srf_maxconso, fsdigit, max )
updgfx( srf_consogfx, dt_conso, 0 )
end

function updateProduction()
Expand Down

0 comments on commit e8c2b36

Please sign in to comment.