Skip to content

Commit

Permalink
Fix Vector Map reading SD Shared SPI BUS
Browse files Browse the repository at this point in the history
  • Loading branch information
jgauchia committed Aug 9, 2024
1 parent d56e77a commit 8da9264
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
34 changes: 20 additions & 14 deletions lib/gui/src/mainScr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ void getActTile(lv_event_t *event)
isScrolled = true;
log_d("Free PSRAM: %d", ESP.getFreePsram());
log_d("Used PSRAM: %d", ESP.getPsramSize() - ESP.getFreePsram());
// if (activeTile == MAP || activeTile == NAV)
if (activeTile == MAP)
{
isPosMoved = true;
redrawMap = true;
}

if (activeTile == SATTRACK)
{
createSatSprite(spriteSat);
Expand All @@ -168,8 +163,6 @@ void getActTile(lv_event_t *event)
else
{
isReady = true;
redrawMap = false;
isPosMoved = false;
}

lv_obj_t *actTile = lv_tileview_get_tile_act(tilesScreen);
Expand Down Expand Up @@ -261,22 +254,35 @@ void updateMap(lv_event_t *event)
getPosition(getLat(), getLon());
if (isPosMoved)
{

tileSize = VECTOR_TILE_SIZE;
viewPort.setCenter(point);

#ifdef SPI_SHARED
tft.endTransaction();
tft.releaseBus();
initSD();
#endif

getMapBlocks(viewPort.bbox, memCache);
generateVectorMap(viewPort, memCache, mapTempSprite);

#ifdef SPI_SHARED
SD.end();
tft.initBus();
#endif

deleteMapScrSprites();
createMapScrSprites();
generateVectorMap(viewPort, memCache, mapTempSprite);

isPosMoved = false;
}
}
else
{
tileSize = RENDER_TILE_SIZE;
generateRenderMap();
generateRenderMap();
}

if (redrawMap)
displayMap(tileSize);
displayMap(tileSize);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions lib/maps/src/renderMaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ void generateRenderMap()
createMapScrSprites();

#ifdef SPI_SHARED
//tft.waitDisplay();
tft.endTransaction();
tft.waitDisplay();
tft.releaseBus();
initSD();
#endif
Expand Down Expand Up @@ -136,13 +136,11 @@ void generateRenderMap()
oldMapTile.zoom = currentMapTile.zoom;
oldMapTile.tilex = currentMapTile.tilex;
oldMapTile.tiley = currentMapTile.tiley;
redrawMap = true;
}

#ifdef SPI_SHARED
SD.end();
tft.initBus();
tft.beginTransaction();
#endif

log_v("TILE: %s", oldMapTile.file);
Expand Down
6 changes: 3 additions & 3 deletions lib/panel/ILI9488_FT5x06_SPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class LGFX : public lgfx::LGFX_Device
#endif
cfg.spi_mode = 0;
cfg.freq_write = 79999999;
cfg.freq_read = 40000000;
cfg.freq_read = 27000000;
cfg.spi_3wire = false;
cfg.use_lock = false;
cfg.dma_channel = 2;
cfg.dma_channel = SPI_DMA_CH_AUTO;
cfg.pin_sclk = TFT_SPI_SCLK;
cfg.pin_mosi = TFT_SPI_MOSI;
cfg.pin_miso = TFT_SPI_MISO;
Expand All @@ -72,7 +72,7 @@ class LGFX : public lgfx::LGFX_Device
cfg.offset_rotation = 0;
cfg.dummy_read_pixel = 8;
cfg.dummy_read_bits = 1;
cfg.readable = false;
cfg.readable = true;
cfg.invert = TFT_INVERT;
cfg.rgb_order = false;
cfg.dlen_16bit = false;
Expand Down
1 change: 1 addition & 0 deletions lib/storage/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void initSD()
digitalWrite(SD_CS,LOW);

#ifdef SPI_SHARED
SD.end();
SDInitOk = SD.begin(SD_CS);
#endif
#ifndef SPI_SHARED
Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ void setup()
#endif
initLvglTask();


#ifndef DISABLE_CLI
initCLI();
initCLITask();
Expand Down

0 comments on commit 8da9264

Please sign in to comment.