That would probably give more resolution as well. Any idea of what the address is? Would it be different on each camera? I wouldn't need to enable lua native calls would I?
I didn't reverse engineer this very thoroughly. Basically, I noticed that Thermometer task (findable by the string "Thermometer" followed by a createtask call) sits in a loop that (among other things) calls a function (at F843FC0) that reads MMIOs based on a table in ROM (found at FFAD6170). On D10, these range from 0xC0900040 to 0xC0900054 (followed by another set from 0xC0900080 to 0xC0900098, not clear if they are related). MMIO can vary between cameras, and it's more likely for models that were released far apart. I didn't see similar code for a540.
I tried dumping these, using the following chdkptp code
!status, t,temps=con:execwait('j=1 t={} for i=0xC0900040,0xC0900054,2 do t[j]={i,peek(i,2)} j=j+1 end return t,{get_temperature(0),get_temperature(1),get_temperature(2)}') for k,v in ipairs(t) do printf('0x%08x:0x%04x\n',v[1],v[2]) end for k,v in ipairs(temps) do printf("%d:%d\n",k-1,v) end
The values seem to be half words (the function only stores a half word) that vary, it's not immediately clear if they have a direct relationship to the temperatures.
The value at 0xc090004a seemed to be consistently 0x03ff when the battery wasn't present, and in the range 0xff to 0xe0 when it was present. get_temperature(2) was returning 37-41 over the same time.
edit:
I may be wrong, but I think that
0xc0900046:0x00e0 < ccd temp
0xc0900048:0x010a < optical temp
0xc090004a:0x00d7 < battery temp
where lower values correspond to higher temps. In addition to the battery removed value, this is based on watching the difference ccd temp in record vs play mode. Units are not clear (if this is correct at all, which is far from certain)
edit:
I think 0xc0900044 is related to battery voltage. ~0x351 at 4.2 volts (external power), ~0x2d9 at 3.66 volts (battery, rec mode)