Skip to content

Commit e74f90d

Browse files
committed
(fix) No STREAMING_DIRECT_MODE when image rotation is requested.
1 parent a6b902e commit e74f90d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ void downloadAndDisplayImage(HttpClient &httpClient)
8888
StateManager::startDownloadTimer();
8989

9090
// Check if direct streaming mode is available and should be used
91-
bool useDirectStreaming = ImageHandler::isDirectStreamingAvailable();
91+
// (direct streaming doesn't support rotation - displays require sequential row writes)
92+
bool useDirectStreaming = ImageHandler::isDirectStreamingAvailable() && !httpClient.hasRotation();
9293

9394
if (useDirectStreaming)
9495
{
@@ -226,6 +227,17 @@ void handleConnectedState()
226227

227228
if (httpClient.checkForUpdate(true, useDirectStreaming))
228229
{
230+
// Re-evaluate direct streaming: rotation requires paged mode
231+
// (displays require sequential row writes, can't handle rotation in streaming)
232+
if (useDirectStreaming && httpClient.hasRotation())
233+
{
234+
Logger::log<Logger::Level::INFO, Logger::Topic::IMAGE>(
235+
"Rotation requested, switching from direct streaming to paged mode\n");
236+
useDirectStreaming = false;
237+
// Close the kept-open connection - paged mode will reopen for each page
238+
httpClient.stop();
239+
}
240+
229241
// Check if OTA update is requested by server
230242
if (httpClient.hasOTAUpdate())
231243
{

0 commit comments

Comments
 (0)