Example #1
0
File: console.c Project: rzel/dim3
void console_add_system(char *txt)
{
	d3col			col;
	
	col.r=col.b=0;
	col.g=1;
	console_add_line(txt,&col);
}
Example #2
0
void script_console_add_line(long str_id)
{
    const char* str = lang_str(str_id);
    console_add_line(str);

    if (print_screen_p && (print_screen_d >= 0)) {
        char nl = '\n';
        // TODO this should be uncached memory
        write(print_screen_d, str, strlen(str) );
        write(print_screen_d, &nl, 1);
    }
}
Example #3
0
void md_save_calls_history(){
	char buf[200], fn[30];
	char big[MD_INFO_BUF_SIZE];
	int big_ln;
	int calls,i, ln, fd;
  static struct utimbuf t;
    unsigned long t2;
    static struct tm *ttm;


	if( (motion_detector->parameters & MD_MAKE_DEBUG_LOG_FILE) == 0 ){
		return;
	}
	

	strcpy(fn,"A/MD_INFO.TXT");//,BUILD_NUMBER,motion_detector->pixels_step);
	fd = open(fn, O_WRONLY|O_CREAT, 0777);
	if( fd>=0) {
		console_add_line("Writing info file...");
		lseek(fd,0,SEEK_END);
    t2 = time(NULL);
    ttm = localtime(&t2);
    big_ln=sprintf(big, 
				"\r\n--- %04u-%02u-%02u  %02u:%02u:%02u\r\n"
				"CHDK Ver: %s [ #%s ]\r\nBuild Date: %s %s\r\nCamera:  %s [ %s ]\r\n"
				"[%dx%d], threshold: %d, interval: %d, pixels step: %d\r\n"
				"region: [%d,%d-%d,%d], region type: %d\r\n"
				"wait interval: %d, parameters: %d, calls: %d, detected cells: %d\r\n", 
				1900+ttm->tm_year, ttm->tm_mon+1, ttm->tm_mday, ttm->tm_hour, ttm->tm_min, ttm->tm_sec,
				HDK_VERSION, BUILD_NUMBER, __DATE__, __TIME__, PLATFORM, PLATFORMSUB,
				motion_detector->columns, motion_detector->rows, motion_detector->threshold, motion_detector->measure_interval, motion_detector->pixels_step,
				motion_detector->clipping_region_column1, motion_detector->clipping_region_row1, motion_detector->clipping_region_column2, motion_detector->clipping_region_row2, motion_detector->clipping_region_mode,
				motion_detector->msecs_before_trigger, motion_detector->parameters, motion_detector->comp_calls_cnt,
				motion_detector->detected_cells
		);

		calls = ( motion_detector->comp_calls_cnt < MD_REC_CALLS_CNT) ?motion_detector->comp_calls_cnt: MD_REC_CALLS_CNT;

		for(i=0;i<calls;i++){
			ln=sprintf(buf,"[%d] - %d\r\n",i,motion_detector->comp_calls[i]);
			if(big_ln+ln>MD_INFO_BUF_SIZE){
	      write(fd,big,big_ln);
				big_ln=0;
			} 
			memcpy(big+big_ln,buf,ln+1);
			big_ln+=ln;
		}
    write(fd,big,big_ln);
		close(fd);
	  t.actime = t.modtime = time(NULL);
    utime(fn, &t);
	}
}
Example #4
0
//-----------------------------------------------
// Display module load/unload error message on console
static void moduleload_error(const char* name, const char* text)
{
    extern volatile int chdk_started_flag;
    if (chdk_started_flag)
    {
        char buf[100];
        sprintf(buf, "Fail to load %s: %s", name, text);

        console_clear();
        console_add_line(buf);
        msleep(1000);
    }
}
Example #5
0
File: console.c Project: rzel/dim3
void console_add_error(char *txt)
{
	d3col			col;
	
	col.g=col.b=0;
	col.r=1;
	console_add_line(txt,&col);

		// if in debug mode, all errors
		// pop open the console
		
	if ((!app.dedicated_host) && (iface.setup.game_debug)) {
		view.console.on=TRUE;
		input_clear_text_input();
	}
}
Example #6
0
//-----------------------------------------------
static void moduleload_error(char* text, int value)
{
    if ( module_fd >=0 )
        b_close( module_fd);

    if ( flat_buf )
        free(flat_buf);

    //extern int console_is_inited();
    extern volatile int chdk_started_flag;
    if ( chdk_started_flag ) {
        char fmt[50];
        strcpy(fmt,"Fail to load %s: ");
        strcpy(fmt+17,text);

        char buf[100];
        sprintf(buf, fmt, module_filename, value);

        console_clear();
        console_add_line(buf);
        msleep(1000);
    }
}