cfrankb / esp-idf-cs3

ESP32 port of an MSDOS game using the ST7789 / ILI9341 LCD display and a joystick module.
MIT License
1 stars 1 forks source link

Problems after changing the display. #4

Open spairo1741 opened 6 months ago

spairo1741 commented 6 months ago
cfrankb commented 6 months ago

Restart the device and enter monitor mode. Grab a copy of the log. idf.py monitor

spairo1741 commented 6 months ago
cfrankb commented 6 months ago

Screenshot_2023-12-09_18-44-41 test.log

cfrankb commented 6 months ago

Screenshot_2023-12-09_23-29-07

what value is the SPI_Frequency set to in driver.cpp ?

cfrankb commented 6 months ago

In the log for my esp32: I (40) boot.esp32: SPI Speed : 40MHz

In your log I (34) boot.esp32s3: Boot SPI Speed : 80MHz

cfrankb commented 6 months ago

I have ordered another ILI9341 so I can test it with one of my esp32s3 but i won't receive it until January.

spairo1741 commented 6 months ago
spairo1741 commented 6 months ago
cfrankb commented 6 months ago

Screenshot_2023-12-10_02-16-10

i think color inversion is RGB/BGR thing on line 398 spi_master_write_data_byte(dev, 0x08);

try replacing 0x08 with 0x00

if you set this value to 0x40 or 0x60 it should also cause the screen to rotate as per the doc.

Screenshot_2023-12-10_02-14-46

cfrankb commented 6 months ago

From the image above, it is clear that the image is flipped horizontally, which something which a different combination of bits in Memory Access Control can also fix. I don't have an ILI9341 hooked to an esp32 device to test at the moment. It is also possible that changing that setting (with the right combination of bits) can also fix the "square picture" things as it is the result of the image being drawn in the wrong orientation. Some experimentation is required here. @spairo1741

spairo1741 commented 6 months ago
cfrankb commented 6 months ago

the colors are correct and horizontal flip is fixed.

spairo1741 commented 6 months ago
cfrankb commented 6 months ago

The health bar doesn't show on level 1 (due to a possible bug). The code exits the loop early when the level is shorter than the screen height. Resulting in no health bar.

Screenshot_2023-12-11_13-36-40

a sub-optimal quick fix can be to move the condition into the inner loop

Screenshot_2023-12-11_13-45-26

attached is level 2

cfrankb commented 6 months ago

20231211_135719

cfrankb commented 6 months ago

alternatively you can play the online version at this url to checkout the colors https://cfrankb.com/games/ems/cs3v2.html

or visit the level editor https://github.com/cfrankb/cs3-map-edit

spairo1741 commented 6 months ago

-Thank you, the colors are set.

/*#if CONFIG_IDF_TARGET_ESP32

define EXAMPLE_ADC1_CHAN0 ADC_CHANNEL_4

define EXAMPLE_ADC1_CHAN1 ADC_CHANNEL_5

else

define EXAMPLE_ADC1_CHAN0 ADC_CHANNEL_2

define EXAMPLE_ADC1_CHAN1 ADC_CHANNEL_3

endif

*/`

cfrankb commented 6 months ago

-Thank you, the colors are set.

  • is it possible to configure ADC channels and joystick parameters in the sdkconfig file?
  • I use a Funduino joystick ver 2.0
  • `#define EXAMPLE_ADC1_CHAN0 ADC_CHANNEL_0 // pin 35 (x) BROWN

    define EXAMPLE_ADC1_CHAN1 ADC_CHANNEL_1 // pin 34 (y) WHITE

i'll add the channels to the config

/#if CONFIG_IDF_TARGET_ESP32 #define EXAMPLE_ADC1_CHAN0 ADC_CHANNEL_4 #define EXAMPLE_ADC1_CHAN1 ADC_CHANNEL_5 #else #define EXAMPLE_ADC1_CHAN0 ADC_CHANNEL_2 #define EXAMPLE_ADC1_CHAN1 ADC_CHANNEL_3 #endif /`

  • uint16_t joy = JOY_NONE; if (adc_vry > 3000) // extra org 50 { joy |= JOY_UP; } else if (adc_vry < 50) // extra org 3000 { joy |= JOY_DOWN; } if (adc_vrx < 50) { joy |= JOY_LEFT; } else if (adc_vrx > 3000) { joy |= JOY_RIGHT; }

my joystick is working in reverse apparently. one more thing to configure

  • the fonts are not cut off at the top, is it the display's fault?

displays have a dead zone at the top and it varies per model. so we would have to set a y-offset for the font.

Screenshot_2023-12-12_09-00-23

Screenshot_2023-12-12_09-08-36

cfrankb commented 6 months ago
  • is it possible to configure ADC channels and joystick parameters in the sdkconfig file?

@spairo1741 I have created another issue to track the joystick configuration https://github.com/cfrankb/esp-idf-cs3/issues/5

cfrankb commented 6 months ago

@spairo1741 does your generic ili9341 have a backlight? not having one could affect the colors.

spairo1741 commented 6 months ago
cfrankb commented 6 months ago

@spairo1741 the only thing that i can think off is the merging of your driver.cpp changes during the latest refactoring of the code.

spairo1741 commented 6 months ago
cfrankb commented 6 months ago
  • Does grandma have any weapons against monsters or does she just have to rely on her wits.

only her wits at the moment as there are no plans to add weapons as this would change the game mechanic completely.

however, new power-ups were added in the remake (invinvibility, fast speed, extra life etc). no level is taking advantage of them at the moment.

* is it possible to financially support the esp-idf-cs3 channel?

not at the moment but i'll update you

cfrankb commented 6 months ago

gameplay changes moved to https://github.com/cfrankb/esp-idf-cs3/issues/6

@spairo1741