My camera is not damaged. But I was not trying to start CHDK core yet.
I did some experiments since my last post. Now I found stable combination that works:
extern unsigned _ExecuteEventProcedure(const char *name,...);
extern unsigned _sprintf(char *stream, const char *format,...);
extern unsigned _LCDMsg_Create (unsigned, unsigned, unsigned);
extern void _LCDMsg_SetStr (unsigned, char * );
static unsigned message;
void save_romlog2(void)
{
unsigned args[4];
args[0] = (unsigned)"SystemEventInit";
call_func_ptr(_ExecuteEventProcedure,args,1);
args[0] = (unsigned)"UI.CreatePublic";
call_func_ptr(_ExecuteEventProcedure,args,1);
args[0] = (unsigned)"System.Create";
call_func_ptr(_ExecuteEventProcedure,args,1);
args[0] = (unsigned)"Driver.Create";
call_func_ptr(_ExecuteEventProcedure,args,1);
args[0] = (unsigned)"BeepDrive";
args[1] = (unsigned) 0x02;
call_func_ptr(_ExecuteEventProcedure,args,2);
args[0] = (unsigned)"GetLogToFile";
args[1] = (unsigned)"A/ROMLOG.LOG";
args[2] = 1;
call_func_ptr(_ExecuteEventProcedure,args,3);
}
/*----------------------------------------------------------------------
spytask
-----------------------------------------------------------------------*/
void spytask(long ua, long ub, long uc, long ud, long ue, long uf)
{
int a = 1;
long voltage;
// core_spytask();
char voltagestr [10];
_SleepTask(800);
while (1){
_SleepTask(300);
if ((physw_status[1] & 0x00002000) == 0){
if (a) {
a = 0;
save_romlog2();
message = _LCDMsg_Create(10,360, 0);
}
}
if (a == 0) {
voltage = _VbattGet();
_sprintf (voltagestr, "%04dmV 0x%08X", voltage, *(int*)(0x9e50+0x0c));
_LCDMsg_SetStr(message, voltagestr);
}
}
}
LCDMsg functions work stable if they called after executing GetLogToFile procedure. Without GetLogToFile they work only from Shooting mode.
And another strange thing is that sprintf from stdio.h causes crash. I used _sprintf from firmware instead.