Pages: [1]   Go Down
  Print  
Author Topic: No script console output - SX20  (Read 333 times)
0 Members and 1 Guest are viewing this topic.
acid2000
Jr. Member
**
Offline Offline

Posts: 93


« on: 21 / April / 2010, 22:37:35 »

I have a really weird bug on the SX20 102b port I'm working on. Most CHDK functionality has been implemented however I can't get any text out of the script console. Scripts run successfully but when they print messages I get a new black box but no text in it, very odd.

I've checked the code and I think this box is printed with COLOR_FG and COLOR_BG. These have been set correctly but still nothing is displayed on screen.

As a side note I don't get any Zebra output - could this be related?
Logged
Microfunguy
Developers
Guru Member
****
Offline Offline

Posts: 1946


« Reply #1 on: 21 / April / 2010, 22:57:25 »

.
I've checked the code and I think this box is printed with COLOR_FG and COLOR_BG..


That is what is says in \core\script.c\script_console_draw().

Try changing the colours to something else.
Logged
acid2000
Jr. Member
**
Offline Offline

Posts: 93


« Reply #2 on: 22 / April / 2010, 10:24:13 »

Quote
That is what is says in \core\script.c\script_console_draw().

Try changing the colours to something else.

I don't understand, this is what it actually says:

Code:
void script_console_draw() {
    int i,c,l;
    for(c = 0; c < script_con_num_lines;   c) {
        i=script_con_line_index(script_con_start_line c);
        l=strlen(script_console_buf[i]);
        draw_txt_string(SCRIPT_CONSOLE_X, SCRIPT_CONSOLE_Y SCRIPT_CONSOLE_NUM_LINES-script_con_num_lines c, script_console_buf[i], MAKE_COLOR(COLOR_BG, COLOR_FG));
        for (; l<SCRIPT_CONSOLE_LINE_LENGTH;   l)
            draw_txt_char(SCRIPT_CONSOLE_X l, SCRIPT_CONSOLE_Y SCRIPT_CONSOLE_NUM_LINES-script_con_num_lines c, ' ', MAKE_COLOR(COLOR_BG, COLOR_FG));
    }
}

No comments there!

I have already tried changing COLOR_BG, COLOR_FG as in my original post.
Logged
Microfunguy
Developers
Guru Member
****
Offline Offline

Posts: 1946


« Reply #3 on: 22 / April / 2010, 11:53:55 »

I don't understand, this is what it actually says:

I mean change MAKE_COLOR(COLOR_BG, COLOR_FG) to MAKE_COLOR(COLOR_BLUE, COLOR_WHITE) for example.
Logged
acid2000
Jr. Member
**
Offline Offline

Posts: 93


« Reply #4 on: 22 / April / 2010, 19:12:27 »

Quote
I mean change MAKE_COLOR(COLOR_BG, COLOR_FG) to MAKE_COLOR(COLOR_BLUE, COLOR_WHITE) for example.

I have.

I've tried:
blue/red
red/blue
black/transparent

I just get the background colour for all of them.

It would appear that draw_string is not working at all for my camera. I know that sprintf does through because I see the OSD. Could there be a function that I have not got right in my stubs? Does anyone know what this is.
Logged
Microfunguy
Developers
Guru Member
****
Offline Offline

Posts: 1946


« Reply #5 on: 22 / April / 2010, 20:02:30 »

Doing a quick search, draw_txt_string also occurs in the games code, debug, palette, calendar, etc.

Do they work ?

Ultimately, it uses whatever function is currently assigned to draw_pixel_proc and that is normally draw_pixel_std .. which simply writes the appropriate colour value to the two buffers.

« Last Edit: 22 / April / 2010, 20:06:53 by Microfunguy » Logged
acid2000
Jr. Member
**
Offline Offline

Posts: 93


« Reply #6 on: 22 / April / 2010, 23:04:38 »

OK, mastermind shows the battery and clock on screen which is drawn with draw_txt_string. The call from this point on must be OK if the arguments are correct.

In addition the 100f SX20 displays console out so it must be something in my sub directory. Does anyone know of any key functions or routines I should investigate first?

Interestingly when I change script_console_draw() to be:

Code:
void script_console_draw() {
    draw_txt_string(screen_width/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, "Hello", MAKE_COLOR(0xDD, 0x11));
}

I get the expected output. Any ideas?



Update:

Ok so it looks like script_console_buf is empty even though script are supposedly writing to the buffer.
« Last Edit: 23 / April / 2010, 00:16:10 by acid2000 » Logged
Microfunguy
Developers
Guru Member
****
Offline Offline

Posts: 1946


« Reply #7 on: 22 / April / 2010, 23:51:17 »

Is there anything in script_console_buf ?

script_console_add_text  uses firmware  functions  strlen, strncpy and strcat.

Are they correct ?
« Last Edit: 22 / April / 2010, 23:56:26 by Microfunguy » Logged
acid2000
Jr. Member
**
Offline Offline

Posts: 93


« Reply #8 on: 23 / April / 2010, 00:17:35 »

No!

strcat was wrong, now works!

Thanks everyone
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: