Closed noamkrief closed 1 day ago
Hi,
When you call lcd.invalidate(0,0,50,50), you are updating an area that starts at 0,0 (top left) and extends to 50,50.
This means that:
lcd.drawText(100,100,os.clock())
is not updated by this lcd.invalidate.
(2) I would recommend checking how often wakeup is being called. Depending on the complexity of the model configuration, it might be more than every 0.1 seconds. In that case, your "resource saver" wouldn’t actually be one.
regards
At each cycle the minimum rectangle is refreshed. Since you ask for a refresh of [0, 0, 50, 50] and the Time in the bottom status bar requests a refresh too, once per second, the rectangle which will be refreshed is big, as the 2 rectangles must be included inside, and they are at opposite corner.
That's an interesting explanation of how lcd.invalidate works; I never could find functionality described en detail.
So,
Thanks for the hint!
@bsongis-frsky Sorry to ask again. But when I change the refresh rate to 1 second: if os.clock() > tempclock1 + 1 then
Then everything seems to work like I would expect. lcd.drawText(100,100,os.clock()) NEVER changes. Not even once per second.
When I lcd.invalidate(0,0,50,50) I expect only the top left 50x50 box to be refreshed. Anything outside of that should NEVER change.
I'm refreshing the screen every 0.1 seconds only at 0,0,50,50
The text at 100,100 refreshes every second for some reason. It should stay the SAME forever. It should NEVER refresh.
local function create()
end
local tempclock1 = 0
local function paint(widget) lcd.drawText(0,0,os.clock()) lcd.drawText(100,100,os.clock())
end
local function wakeupnow(widget)
end
local function init() system.registerWidget({key="noam1", name="noam1", create=create, paint=paint, wakeup=wakeupnow, title = false}) end
return {init=init}