peeking at icon bar
Chris Hall (132) 3558 posts |
Is it possible to examine the icon bar icon of another application (other than by eye or saving a screenshot and examining it)? A strange question you might think but .. I have a CM4 with a module task running that reads the CPU temperature and thinks it is controlling a fan, changing the icon bar icon colour to suit the fan’s demanded speed. Actually the fan is mounted on a CJE micros RTC board using an EMC2101 controller. So I want to examine the colour of the icon bar icon for the Fargon module task and get my app to request the corresponding fan speed depending on the colour. |
Andrew Conroy (370) 740 posts |
Yes, you can iterate through the icons on the iconbar to find out which task they belong to, and then you can find the icon details using Wimp_GetIconState. Drop me an email if you want example code. Would it be easier to just read the CPU temperature yourself? |
Rick Murray (539) 13850 posts |
CPUClock? Look at the help. I think CPUClock_ReadTemperature tell you will what want you to know. |
Rick Murray (539) 13850 posts |
Ummm… I think I need tea. Either that, or I’m channelling my inner Yoda. |
Chris Hall (132) 3558 posts |
This is what I like about RISC OS – lots of help to write some software to overcome a software deficiency. I think you are right – CPUClock_ReadTemperature will do all I want. Just need to work out the syntax. Might also look at the icon bar icon just for the hell of it. PM sent. |
Chris Hall (132) 3558 posts |
Peeking at the icon bar was not the sensible way to go, many thanks for the guidance. I now have a little app sitting on the icon bar showing temperature and CPU speed, changing colour as the temperature changes and ready to issue fan speed commands over IIC once I have got the EMC2101 board and connected it to the CJE RTC board. At the moment the fan is spinning at full speed continuously and the temperature is down to 39 deg C. Now all I have to do is to remember how to get it on the right side of the iconbar. Hadn’t tried three lines of indirected text on an icon bar icon before. |
Chris Hall (132) 3558 posts |
and ready to issue fan speed commands over IIC once I have got the EMC2101 board and connected it to the CJE RTC board. (Not sure whether replying to myself is a sign of madness but …) And after some slightly bodged soldering the EMC2101 board is mounted on the CJE RTC board and does, indeed, respond to fan speed controls at IIC address &4C (as does the fan). Now to play around with temperature versus fan speed commands Pity there’s no room left on the icon bar icon to display fan RPM.. |
Chris Hall (132) 3558 posts |
Well I haven’t managed to read fan RPM successfully yet but I have set up the fan control to change speed with suitable hysteresis:
It settles down with the fan running slowly and silently at about 42°C but I haven’t quite got the hysteresis correct yet… More bug searching. Suspect that CPUClock_ReadTemperature occasionally returns duff readings or produces an error (which I haven’t yet trapped). Either would mess up the hysteresis. Update: the bug was in my code, now fixed. The machine is a CM4/IO board with a Waveshare 12V fan/heatsink, 8GB RAM, 32GB eMMc and SATA storage. |