Skip to content

Commit 9fb575c

Browse files
committed
chore: Clean code
1 parent 9223ad4 commit 9fb575c

File tree

2 files changed

+2
-37
lines changed

2 files changed

+2
-37
lines changed

lib/maps/src/maps.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ uint32_t Maps::batchFlushCount = 0;
6767
*/
6868
Maps::Maps() : fillPolygons(true)
6969
{
70-
7170
ESP_LOGI(TAG, "Maps constructor completed");
7271
}
7372

@@ -84,7 +83,6 @@ Maps::Maps() : fillPolygons(true)
8483
*/
8584
uint16_t Maps::lon2posx(float f_lon, uint8_t zoom, uint16_t tileSize)
8685
{
87-
// Use direct calculation (more efficient than complex transformation matrices)
8886
return static_cast<uint16_t>(((f_lon + 180.0f) / 360.0f * (1 << zoom) * tileSize)) % tileSize;
8987
}
9088

@@ -101,7 +99,6 @@ uint16_t Maps::lon2posx(float f_lon, uint8_t zoom, uint16_t tileSize)
10199
*/
102100
uint16_t Maps::lat2posy(float f_lat, uint8_t zoom, uint16_t tileSize)
103101
{
104-
// Use direct calculation (more efficient than complex transformation matrices)
105102
float lat_rad = f_lat * static_cast<float>(M_PI) / 180.0f;
106103
float siny = tanf(lat_rad) + 1.0f / cosf(lat_rad);
107104
float merc_n = logf(siny);
@@ -323,10 +320,7 @@ void Maps::initMap(uint16_t mapHeight, uint16_t mapWidth)
323320
// Initialize tile cache system
324321
initTileCache();
325322

326-
// Initialize background preload system
327-
328323
// Initialize polygon optimizations
329-
// Initialize polygon optimization system
330324
polygonCullingEnabled = true;
331325
optimizedScanlineEnabled = false;
332326
polygonRenderCount = 0;
@@ -348,8 +342,6 @@ void Maps::deleteMapScrSprites()
348342

349343
// Clear tile cache to free memory
350344
clearTileCache();
351-
352-
353345
}
354346

355347
/**
@@ -816,7 +808,7 @@ bool Maps::loadPalette(const char* palettePath)
816808
{
817809
if (fread(rgb888, 3, 1, f) == 1)
818810
{
819-
// Convert RGB888 to RGB332 using same method as tile_generator.py hex_to_rgb332_direct
811+
// Convert RGB332 to RGB888
820812
uint8_t r332 = rgb888[0] & 0xE0; // Keep top 3 bits
821813
uint8_t g332 = (rgb888[1] & 0xE0) >> 3; // Keep top 3 bits, shift right
822814
uint8_t b332 = rgb888[2] >> 6; // Keep top 2 bits
@@ -1176,12 +1168,6 @@ void Maps::drawPolygonBorder(TFT_eSprite &map, const int *px, const int *py, con
11761168
}
11771169
}
11781170

1179-
1180-
1181-
1182-
1183-
1184-
11851171
/**
11861172
* @brief Initialize tile cache system
11871173
*
@@ -1372,16 +1358,6 @@ size_t Maps::getCacheMemoryUsage()
13721358
return memoryUsage;
13731359
}
13741360

1375-
1376-
1377-
1378-
1379-
1380-
1381-
1382-
1383-
1384-
13851361
/**
13861362
* @brief Renders a map tile from a binary file onto a sprite.
13871363
*

lib/maps/src/maps.hpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum DrawCommand : uint8_t
5858
SIMPLE_TRIANGLE = 0x98, /**< Simple triangle (x1, y1, x2, y2, x3, y3) */
5959
DASHED_LINE = 0x99, /**< Dashed line with pattern */
6060
DOTTED_LINE = 0x9A, /**< Dotted line with pattern */
61-
};
61+
};
6262

6363
/**
6464
* @class Maps
@@ -173,8 +173,6 @@ class Maps
173173
static uint32_t polygonCulledCount; /**< Polygons culled (not rendered) */
174174
static uint32_t polygonOptimizedCount; /**< Polygons using optimized algorithms */
175175

176-
177-
178176
// Efficient batch rendering system
179177
static RenderBatch* activeBatch; /**< Currently active render batch */
180178
static size_t maxBatchSize; /**< Maximum batch size for hardware */
@@ -290,11 +288,6 @@ class Maps
290288
MemoryGuard& operator=(const MemoryGuard&) = delete;
291289
};
292290

293-
// Memory monitoring methods
294-
295-
// Polygon optimization methods
296-
297-
298291
// Efficient batch rendering methods
299292
void initBatchRendering(); /**< Initialize batch rendering system */
300293
void createRenderBatch(size_t capacity); /**< Create new render batch */
@@ -336,9 +329,5 @@ class Maps
336329
void scrollMap(int16_t dx, int16_t dy);
337330
void preloadTiles(int8_t dirX, int8_t dirY);
338331
bool renderTile(const char* path, int16_t xOffset, int16_t yOffset, TFT_eSprite &map);
339-
340-
// Background preload public methods
341-
342-
// Memory monitoring public methods
343332
};
344333

0 commit comments

Comments
 (0)