fdivitto / FabGL

ESP32 Display Controller (VGA, PAL/NTSC Color Composite, SSD1306, ST7789, ILI9341), PS/2 Mouse and Keyboard Controller, Graphics Library, Sound Engine, Game Engine and ANSI/VT Terminal
http://www.fabglib.org
Other
1.41k stars 207 forks source link

request for a simple draw demo #14

Closed YordanYanakiev closed 5 years ago

YordanYanakiev commented 5 years ago

If it is possible I would like to have a simple demo regarding just drawing a few random dots or lines in the loop.

The point is to clearly understand the way it is supposed to be done this. As simplest as possible will do.

bytefresser commented 5 years ago

You can see it in example simpleterminalout. Check demo4.

YordanYanakiev commented 5 years ago

I am not sure where is this "demo4" file. Could You provide a link please?

karlTH commented 5 years ago

in this exemple https://github.com/fdivitto/FabGL/blob/master/examples/SimpleTerminalOut/SimpleTerminalOut.ino

YordanYanakiev commented 5 years ago

tried it, as well other demos, none seem to be working on my setup due some reason unknown:


#include "fabgl.h"

#if USE_8_COLORS
#define VGA_RED    GPIO_NUM_17
#define VGA_GREEN  GPIO_NUM_16
#define VGA_BLUE   GPIO_NUM_4
#define VGA_HSYNC  GPIO_NUM_15
#define VGA_VSYNC  GPIO_NUM_2
#elif USE_64_COLORS
#define VGA_RED1   GPIO_NUM_22
#define VGA_RED0   GPIO_NUM_21
#define VGA_GREEN1 GPIO_NUM_19
#define VGA_GREEN0 GPIO_NUM_18
#define VGA_BLUE1  GPIO_NUM_5
#define VGA_BLUE0  GPIO_NUM_4
#define VGA_HSYNC  GPIO_NUM_23
#define VGA_VSYNC  GPIO_NUM_15
#endif

// the setup function runs once when you press reset or power the board
void setup() 
{
    Serial.begin( 115200 ); delay( 500 ); Serial.write( "\n\n\n" ); // DEBUG ONLY

#if USE_8_COLORS
    VGAController.begin( VGA_RED, VGA_GREEN, VGA_BLUE, VGA_HSYNC, VGA_VSYNC );
#elif USE_64_COLORS
    VGAController.begin( VGA_RED1, VGA_RED0, VGA_GREEN1, VGA_GREEN0, VGA_BLUE1, VGA_BLUE0, VGA_HSYNC, VGA_VSYNC );
#endif

    VGAController.setResolution( VGA_640x400_70Hz, 640, 400 );
    //VGAController.setResolution(VGA_640x240_60Hz);    // select to have more free memory

    // this speed-up display but may generate flickering
    VGAController.enableBackgroundPrimitiveExecution( false );

}

// the loop function runs over and over again until power down or reset
void loop() 
{
    demo4();
}

void demo4()
{

    for( int i = 0; i < 500; ++i )
    {
        Canvas.setPenColor( random( 4 ), random( 4 ), random( 4 ) );
        Canvas.setPixel( random( 640 ), random( 350 ) );
        delay( 15 );
    }
    delay( 500 );

    for( int i = 0; i < 50; ++i )
    {
        Canvas.setPenColor( random( 4 ), random( 4 ), random( 4 ) );
        Canvas.drawLine( random( 640 ), random( 350 ), random( 640 ), random( 350 ) );
        delay( 50 );
    }
    delay( 500 );

    for( int i = 0; i < 50; ++i )
    {
        Canvas.setPenColor( random( 4 ), random( 4 ), random( 4 ) );
        Canvas.drawRectangle( random( 640 ), random( 350 ), random( 640 ), random( 350 ) );
        delay( 50 );
    }
    delay( 500 );

    for( int i = 0; i < 50; ++i )
    {
        Canvas.setPenColor( random( 4 ), random( 4 ), random( 4 ) );
        Canvas.drawEllipse( random( 640 ), random( 350 ), random( 640 ), random( 350 ) );
        delay( 50 );
    }

}
bytefresser commented 5 years ago

Select 8 or 64color configuration. Check the first lines in the example.

YordanYanakiev commented 5 years ago

I've did it as noted, yet I can not make it works. it is working flawlessly on other similar library with the same configuration anyway.

On Thu, 30 May 2019 at 21:58, Adrian Lorenz notifications@github.com wrote:

Select 8 or 64color configuration. Check the first lines in the example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fdivitto/FabGL/issues/14?email_source=notifications&email_token=ABR3IN2CBU6RWO2KEEQNPM3PYAPUTA5CNFSM4HRC3SH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWTGSSQ#issuecomment-497445194, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR3INY2IVD4OZZ3NGTH2WLPYAPUTANCNFSM4HRC3SHQ .

-- Yordan Yanakiev design & software architectures

fdivitto commented 5 years ago

it is working flawlessly on other similar library with the same configuration anyway.

...for example? Which library? Can you post the schema you have used?

YordanYanakiev commented 5 years ago

Sorry for the late answer fdvitto. Here the circuit i am using: image ( V+ goes to 5V, V- goes to GND ) As well I have a question: Can we use the library in a thread working on 1st or second core with xTaskCreatePinnedToCore ? I am using currently "https://github.com/bitluni/ESP32Lib" library, anyway i wonder if there is a faster or/and is there one which works in a thread.

fdivitto commented 5 years ago

You've chosen 8 colors mode, so you have to set:

define USE_8_COLORS 1

define USE_64_COLORS 0

YordanYanakiev commented 5 years ago

It is set on 8 color mode. just when i were copy-pasting probably didn't copy it.

On Tue, 4 Jun 2019 at 09:08, Fabrizio Di Vittorio notifications@github.com wrote:

You've chosen 8 colors mode, so you have to set:

define USE_8_COLORS 1

define USE_64_COLORS 0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fdivitto/FabGL/issues/14?email_source=notifications&email_token=ABR3IN44ZCWNR6EMT2Z2YETPYYBFXA5CNFSM4HRC3SH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW3QSDA#issuecomment-498534668, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR3IN5P6O3RUNFIVINJDZ3PYYBFXANCNFSM4HRC3SHQ .

-- Yordan Yanakiev design & software architectures

fdivitto commented 5 years ago

Ok, at this point I just don't know why it doesn't work and you haven't said yet which "similar" library works. There are several possibilities still to explore: one of these is to check the ESP32 revision number. It must be rev-1 (not 0).

Il giorno 4 giu 2019, alle ore 12:31, Yordan Yanakiev notifications@github.com ha scritto:

It was set on 8 color mode. just when i were copy-pasting probably didn't copy it.

On Tue, 4 Jun 2019 at 09:08, Fabrizio Di Vittorio notifications@github.com wrote:

You've chosen 8 colors mode, so you have to set:

define USE_8_COLORS 1

define USE_64_COLORS 0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fdivitto/FabGL/issues/14?email_source=notifications&email_token=ABR3IN44ZCWNR6EMT2Z2YETPYYBFXA5CNFSM4HRC3SH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW3QSDA#issuecomment-498534668, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR3IN5P6O3RUNFIVINJDZ3PYYBFXANCNFSM4HRC3SHQ .

-- Yordan Yanakiev design & software architectures — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fdivitto/FabGL/issues/14?email_source=notifications&email_token=ACKNPCRUVGUT5UONQPKTKG3PYY77VA5CNFSM4HRC3SH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW4EO7Q#issuecomment-498616190, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKNPCRLBNO4IUEY25RCR5TPYY77VANCNFSM4HRC3SHQ.

YordanYanakiev commented 5 years ago

I am using "https://github.com/bitluni/ESP32VGA" with the very same config for bit color. The revision of the SDK is 2

fdivitto commented 5 years ago

I meant chip revision (rev0 doesn't work, rev 1 should work).

YordanYanakiev commented 5 years ago

chip_info.revision returns 1

fdivitto commented 5 years ago

In my board I have a led connected to PIN2 (where you have VSYNC): this doesn't work for me, maybe because the LED circuit modifies VSYNC signal. This is the reason I suggest to avoid to use that PIN in (look at the bottom of the page):

http://www.fabglib.org/conf_v_g_a.html

Could this be the reason?

YordanYanakiev commented 5 years ago

well.. it works with the other lib.. hmm need to try somehow.. the led is blinking as a mad while it is working with the other lib, but it works.. hmm.