Author Topic: Wanted: temperatures from your cams  (Read 70134 times)

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #100 on: September 04, 2016, 08:37:59 PM »
Hi Alex
I don´t understand very well, what your function does. What is MOD? And where is "-60" ?
Edgar

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11646
  • 5D Mark Free
Re: Wanted: temperatures from your cams
« Reply #101 on: September 04, 2016, 09:55:14 PM »
MOD is the modulo operation: MOD(a,b) is from 0 to b-1 (a and b both int32_t, b > 1). C has the % operator, but that one gives negative numbers as well, which doesn't match what I've learned in the math class about modulo (see https://en.wikipedia.org/wiki/Modular_arithmetic ). That's why I've defined the MOD macro in imath.h.

And 150 * 40 / 100 = 60.

However, that definition wraps around at 102 degrees to 0, so it will fail at negative temperatures. A better version that works from -20 to 80 degrees is:

Code: [Select]
#define EFIC_CELSIUS (MOD(efic_temp - 100, 256) * 40 / 100 - 20)

Before/after (efic_temp from 0 to 255):
Code: [Select]
42 42 43 43 44 ... 101 101 102 0 0 0 1 1 2      ... 40 40 41 41 42
42 42 43 43 44 ... 81 81 82 -20 -20 -20 -19 -19 ... 40 40 41 41 42

I'm not sure at which point this number really wraps around, but at least this definition should cover the usual temperature range. If anyone wants to place his EOS M in a freezer or oven for measurements, that data would be welcome, but please be very careful with condensation and/or heat (you can damage the camera). Or, it may be safer to just find the conversion function in Canon code.

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #102 on: September 05, 2016, 05:05:42 PM »
Thanks for the explanaton, Alex. I must reflect a bit about this, next days...
Edgar

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #103 on: September 08, 2016, 10:59:28 PM »
I would like to use this one:
Code: [Select]
#define EFIC_CELSIUS (MOD(efic_temp - 95, 256) * 40 / 100 - 22)
This would cover a temperature-range between -22°C and  +80"C

Temperatures under -20"C can be possible ( in Sibirien :) ) but when you turn your cam on, the temperature will rise.
And I guess, Canon will shutdown the cam reaching about 80°C
So this temperature range from -22°C - +80°C should be satisfactory.

Edgar

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #104 on: September 09, 2016, 12:09:44 AM »
I did some testing with 1200D.
See the table below. (A => RAW; B => EXIF (°C))
Looks like it is close to group 5 (0,6x-65).
What do you think?

Yes, group 5 should be fine:



Edgar

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #105 on: September 09, 2016, 08:11:08 PM »
The EOS-M temperature jump is fixed. Thankyou Alex  :)
Edgar

JohanJ

  • Freshman
  • **
  • Posts: 57
Re: Wanted: temperatures from your cams
« Reply #106 on: January 21, 2017, 06:16:41 PM »
@escho
Here is data from 100D/SL1 w/ ML Beta-4a (magiclantern-Nightly.2016Oct05.100D101)
Tried to cool down the cam in the fridge for about an hour. First shot is therefor with lower temp, looks strange in RAW.
I took a picture in LV mode about every minute and tried to keep the cam busy with focusing in between.

Code: [Select]
Time    RAW ExifC
0 143 15
1 144 24
2 146 26
3 150 30
4 150 32
5 155 35
6 156 36
7 156 39
8 159 41
9 164 42
10 164 44
11 164 45
12 164 47
13 166 47
14 165 48
15 172 49
16 172 50
17 173 51
18 173 52
19 172 53
20 174 53
21 174 54
22 171 55
23 176 55
24 176 56
25 175 56
26 180 57
27 180 57
28 178 58
29 178 59
30 181 59
31 178 60

60D.111 / 100D.101 / M2.103

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #107 on: January 21, 2017, 07:51:03 PM »
Thanks Johan

The data look pretty nice. I will have a closer look to them later next week

Edgar

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3081
  • 5D3 / M1 / 7D / 70D / SL1
Re: Wanted: temperatures from your cams
« Reply #108 on: January 21, 2017, 10:25:53 PM »
Per @a1ex's request -- I was able to use this command line to spit out Camera Temperatures via exiftool with ease on Mac OS X:

Code: [Select]
exiftool -CameraTemperature
rather than diving through the entire block with this:

Code: [Select]
exiftool -U
unless you want to go for a swim.  :P

Anyway here are the results I got from doing the same test as @JohanJ earlier this week coming from @nikfreak's Nightly.2017Jan06.70D112 (with an exception that the body was left in an A/C controlled room at work to begin with for this test purpose):

Code: [Select]
Time / RAW / ExifC
0  152 26
1  161 26
2  164 29
3  169 31
4  174 32
5  179 33
6  181 34
7  180 34
8  182 36
9  185 37
10 185 38
11 192 39
12 191 39
13 193 40
14 193 40
15 196 41
16 194 41
17 202 50
18 202 51
19 202 51
20 201 51
21 201 52
22 206 52
23 206 52
24 206 52
25 207 53
26 207 53
27 207 53
28 207 53
29 211 53
30 211 53
31 211 53
5D3.113 • 5D3.123 • EOSM.203 • 7D.203 • 70D.112 • 100D.101

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #109 on: February 20, 2017, 08:31:27 PM »
Find some time to make the graph and formula for 70D: https://seescho.wordpress.com/2016/04/24/temperaturanzeige-mit-magiclantern/
The 70D fits fine to convertion-group 5. So I guess, we will take:
Code: [Select]
0,6x - 65
I´m working on 100D

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #110 on: February 20, 2017, 09:43:37 PM »
And the 100D made its way through LibreOffice Calc, too. Formula and graph is on my website. Same link as one post before: https://seescho.wordpress.com/2016/04/24/temperaturanzeige-mit-magiclantern/

The 100D ist a cam for group 1:
Code: [Select]
x - 128

nikfreak

  • Developer
  • Hero Member
  • *****
  • Posts: 1096
Re: Wanted: temperatures from your cams
« Reply #111 on: February 21, 2017, 08:26:50 AM »
thanx for 70D and 100D.
70D.112 & 100D.101

esas

  • New to the forum
  • *
  • Posts: 22
  • 70D.112, 650D.104, EOSM.202
Re: Wanted: temperatures from your cams
« Reply #112 on: December 17, 2017, 10:21:01 PM »
Just bought a 70D, coming from a 650D and noticed that temperature was missing in latest nightly.

Here are the results from my test:

Code: [Select]
133 6
138 13
141 15
146 16
151 18
156 20
158 22
161 23
162 24
170 25
172 27
175 28
173 29
181 29
183 32
185 34
188 34
189 36
194 37
191 38
194 39
192 39
197 40
196 41
201 42
202 44
206 45
209 47
207 47
210 48
211 50
217 51

I exluded some readings where the raw units changed before/after picture was taken.





escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #113 on: December 18, 2017, 07:39:27 PM »
Thanks for the measurment. I will have a closer look into it next week.

esas

  • New to the forum
  • *
  • Posts: 22
  • 70D.112, 650D.104, EOSM.202
Re: Wanted: temperatures from your cams
« Reply #114 on: December 21, 2017, 11:04:43 PM »
Looking at the previous results for 70D I think it's wrong to include several plots with the same values. This will bias the results. If you exclude the duplicates in DeafEyeJedi's test the result from my measurements and DeafEyeJedi's are not that far apart.




a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11646
  • 5D Mark Free
Re: Wanted: temperatures from your cams
« Reply #115 on: May 26, 2018, 05:53:02 PM »
Leegong and Greg identified yet another temperature sensor - PROP_BOARD_TEMP. This one appears to be given in degrees Celsius on all models, with an offset of 128.

5D3: it's updated more often than EFIC_TEMP and has higher variations, but values stay roughly close to the old one. Tested range: from about 25 to about 40 degrees (the latter being in LiveView). When the indicator was showing 31 EFIC and 27-28 BOARD, I took a picture and EXIF info showed 27 degrees.

60D: not reported at startup in photo mode; it appears after a while (possibly seconds, possibly minutes); what triggers it is unknown (it's not half-shutter, it's not photo capture); in LiveView it's reported more often. When the indicator was showing 28-30 EFIC and -128 (0 raw), I took some pictures; afterwards, the indicator showed either -128 or 24/25 BOARD, and all pictures have 24/25 degrees in EXIF.

70D: not reported at startup, likely similar to 60D. Only tested in QEMU.

Might be useful to cross-check the measurements. I hoped it could replace the old method (if all models use X-128, it would be an advantage over model-specific scaling/offset), but given that it's not always reported at startup and photo capture doesn't trigger it, it's probably not a good idea to "fix" the current (working) code.

Mystery: the BOARD temperature appears closer to the value ending up in EXIF, at least in the first tests, but since it's not reported during photo capture (on 60D I've had two instances where the indicator showed -128 before and after taking a picture), that gives me some doubts.

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #116 on: July 22, 2018, 09:41:19 AM »
@alex
I have a 600D and a 6D. How can I help?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11646
  • 5D Mark Free
Re: Wanted: temperatures from your cams
« Reply #117 on: July 22, 2018, 12:56:10 PM »
Here's the draft patch I've experimented with, back then:
Code: [Select]
diff -r 103ed3a98762 -r c3ae76124631 modules/lua/lua_camera.c
--- a/modules/lua/lua_camera.c
+++ b/modules/lua/lua_camera.c
@@ -227,7 +227,7 @@
     ///
     /// TODO: Celsius.
     // @tfield int temperature readonly
-    else if(!strcmp(key, "temperature")) lua_pushinteger(L, efic_temp);
+    else if(!strcmp(key, "temperature")) lua_pushinteger(L, efic_temperature);
     /// Gets a @{gui} object that controls Canon GUI state (PLAY, MENU, QR, various dialogs)
     // @tfield gui gui
     else if(!strcmp(key, "gui"))
diff -r 103ed3a98762 -r c3ae76124631 src/debug.c
--- a/src/debug.c
+++ b/src/debug.c
@@ -659,24 +659,13 @@
 #endif
 
 #ifdef FEATURE_SHOW_CMOS_TEMPERATURE
-#ifdef EFIC_CELSIUS
-#define FAHRENHEIT (EFIC_CELSIUS * 9 / 5 + 32)
 static MENU_UPDATE_FUNC(efictemp_display)
 {
     MENU_SET_VALUE(
-        "%d C, %d F, %d raw",
-        EFIC_CELSIUS, FAHRENHEIT, efic_temp
+        "%d C, %d F",
+        efic_temperature, efic_temperature * 9 / 5 + 32
     );
 }
-#else
-static MENU_UPDATE_FUNC(efictemp_display)
-{
-    MENU_SET_VALUE(
-        "%d raw (help needed)",
-        efic_temp
-    );
-}
-#endif
 #endif
 
 #if 0 // CONFIG_5D2
diff -r 103ed3a98762 -r c3ae76124631 src/flexinfo.c
--- a/src/flexinfo.c
+++ b/src/flexinfo.c
@@ -1633,10 +1633,8 @@
         }
         case INFO_STRING_TEMPERATURE:
         {
-     #ifdef EFIC_CELSIUS
-            snprintf(buffer, maxsize, "%d", EFIC_CELSIUS);
+            snprintf(buffer, maxsize, "%d", efic_temperature);
             break;
-     #endif
         }
         case INFO_STRING_WBMODE:
         {
diff -r 103ed3a98762 -r c3ae76124631 src/lens.c
--- a/src/lens.c
+++ b/src/lens.c
@@ -2734,10 +2734,9 @@
 
 static LVINFO_UPDATE_FUNC(temp_update)
 {
-  #ifdef EFIC_CELSIUS
     LVINFO_BUFFER(8);
     
-    int t = EFIC_CELSIUS;
+    int t = efic_temperature;
     snprintf(buffer, sizeof(buffer), "%d"SYM_DEGREE"C", t);
     if (t >= 60)
     {
@@ -2747,7 +2746,6 @@
     {
         item->color_bg = COLOR_ORANGE;
     }
-  #endif
 }
 
 static LVINFO_UPDATE_FUNC(mvi_number_update)
diff -r 103ed3a98762 -r c3ae76124631 src/propvalues.c
--- a/src/propvalues.c
+++ b/src/propvalues.c
@@ -89,7 +89,6 @@
 
 volatile PROP_INT(PROP_LV_DISPSIZE, lv_dispsize);
 volatile PROP_INT(PROP_LIVE_VIEW_VIEWTYPE, _expsim);
-volatile PROP_INT(PROP_EFIC_TEMP, efic_temp);
 volatile PROP_INT(PROP_GUI_STATE, gui_state);
 volatile PROP_INT(PROP_PIC_QUALITY, pic_quality);
 volatile PROP_INT(PROP_AVAIL_SHOT, avail_shot);
@@ -112,6 +111,14 @@
 volatile PROP_INT(PROP_LV_FOCUS_STATUS, lv_focus_status);
 volatile PROP_INT(PROP_ICU_UILOCK, icu_uilock);
 
+volatile int efic_temperature;
+
+PROP_HANDLER(PROP_EFIC_TEMP)
+{
+    int efic_temp = buf[0];
+    efic_temperature = EFIC_CELSIUS;
+}
+
 #ifdef CONFIG_NO_DEDICATED_MOVIE_MODE
 int ae_mode_movie = 1;
 #else
diff -r 103ed3a98762 -r c3ae76124631 src/propvalues.h
--- a/src/propvalues.h
+++ b/src/propvalues.h
@@ -47,7 +47,7 @@
 extern int shooting_mode;        /* C3M => M */
 extern int shooting_mode_custom; /* C3M => C3 */
 extern int shooting_type;
-extern int efic_temp;
+extern int efic_temperature;     /* degrees Celsius */
 extern int gui_state;
 extern int auto_iso_range;
 extern int pic_quality;
diff -r c3ae76124631 -r 7f9734aad5be src/debug.c
--- a/src/debug.c
+++ b/src/debug.c
@@ -659,11 +659,21 @@
 #endif
 
 #ifdef FEATURE_SHOW_CMOS_TEMPERATURE
-static MENU_UPDATE_FUNC(efictemp_display)
+
+static PROP_INT(PROP_EFIC_TEMP, efic_temp_raw);
+static PROP_INT(PROP_BOARD_TEMP, board_temp_raw);
+
+static MENU_UPDATE_FUNC(temperature_display)
 {
     MENU_SET_VALUE(
-        "%d C, %d F",
-        efic_temperature, efic_temperature * 9 / 5 + 32
+        "%d, %d "SYM_DEGREE"C",
+        efic_temperature, board_temperature
+    );
+    MENU_SET_WARNING(MENU_WARN_INFO,
+        "Fahrenheit: %d, %d. Raw values: %d, %d.",
+        efic_temperature * 9 / 5 + 32,
+        board_temperature * 9 / 5 + 32,
+        efic_temp_raw, board_temp_raw
     );
 }
 #endif
@@ -994,15 +1004,9 @@
 #ifdef FEATURE_SHOW_CMOS_TEMPERATURE
     {
         .name = "Internal Temp",
-        .update = efictemp_display,
+        .update = temperature_display,
         .icon_type = IT_ALWAYS_ON,
- #ifdef EFIC_CELSIUS
-        .help = "EFIC chip temperature (somewhere on the mainboard).",
- #else
- .help = "EFIC chip temperature (raw values).",
- .help2 = "http://www.magiclantern.fm/forum/index.php?topic=9673.0",
- #endif
-        //.essential = FOR_MOVIE | FOR_PHOTO,
+        .help = "Internal names: EFIC_TEMP and BOARD_TEMP. Sensor locations are unknown.",
     },
 #endif
     #if 0 // CONFIG_5D2
diff -r c3ae76124631 -r 7f9734aad5be src/property.h
--- a/src/property.h
+++ b/src/property.h
@@ -185,11 +185,9 @@
 #define PROP_EFIC_TEMP          0x80030013
 #else
 #define PROP_EFIC_TEMP          0x80030014
+#define PROP_BOARD_TEMP         0x80030035
 #endif
 
-#define PROP_EFIC_TEMP_MAYBE            0x010100ed
-//#define PROP_BATTERY_RAW_LEVEL_MAYBE          0x80030014
-
 #define PROP_ARTIST_STRING      0x0E070000
 #define PROP_COPYRIGHT_STRING   0x0E070001
 
diff -r c3ae76124631 -r 7f9734aad5be src/propvalues.c
--- a/src/propvalues.c
+++ b/src/propvalues.c
@@ -112,6 +112,7 @@
 volatile PROP_INT(PROP_ICU_UILOCK, icu_uilock);
 
 volatile int efic_temperature;
+volatile int board_temperature;
 
 PROP_HANDLER(PROP_EFIC_TEMP)
 {
@@ -119,6 +120,12 @@
     efic_temperature = EFIC_CELSIUS;
 }
 
+PROP_HANDLER(PROP_BOARD_TEMP)
+{
+    int board_temp = buf[0];
+    board_temperature = board_temp - 128;
+}
+
 #ifdef CONFIG_NO_DEDICATED_MOVIE_MODE
 int ae_mode_movie = 1;
 #else
diff -r c3ae76124631 -r 7f9734aad5be src/propvalues.h
--- a/src/propvalues.h
+++ b/src/propvalues.h
@@ -48,6 +48,7 @@
 extern int shooting_mode_custom; /* C3M => C3 */
 extern int shooting_type;
 extern int efic_temperature;     /* degrees Celsius */
+extern int board_temperature;    /* same */
 extern int gui_state;
 extern int auto_iso_range;
 extern int pic_quality;

Questions you may try to answer:
- are these values any closer to EXIF temperature, than what we currently use (PROP_EFIC_TEMP) ?
- any way to force an update for this property? (at startup, it sometimes reports 0, sometimes even after taking a picture)

escho

  • Hero Member
  • *****
  • Posts: 539
Re: Wanted: temperatures from your cams
« Reply #118 on: July 22, 2018, 03:19:44 PM »
thx