Here's the draft patch I've experimented with, back then:
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)