Skip to content

Fix generic spi graphics setup#3287

Open
mikmog wants to merge 2 commits intonanoframework:mainfrom
mikmog:fix-generic-spi-graphics-setup
Open

Fix generic spi graphics setup#3287
mikmog wants to merge 2 commits intonanoframework:mainfrom
mikmog:fix-generic-spi-graphics-setup

Conversation

@mikmog
Copy link
Copy Markdown
Contributor

@mikmog mikmog commented Apr 6, 2026

Description

Fixes two issues in Generic_SPI graphic driver.

  • OS_DELAY cmd enum unintended use. Calculates wait in milliseconds. Cmd enum has value of 1.
  • SetupDisplayAttributes, Setting height for wrong side.

Motivation and Context

Discovered during development. Breakout to own PR.
General improvements and bug fixes.

How Has This Been Tested?

On an ESP32_S3 Feather and Ili9488 display

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

Bug Fixes

  • Corrected display attribute configuration for proper screen dimension handling
  • Fixed timing delay calculation for display sleep operations

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5731dd54-0cab-40ba-ba8a-759bc67510bf

📥 Commits

Reviewing files that changed from the base of the PR and between be1bb6f and 70dd74a.

📒 Files selected for processing (1)
  • src/nanoFramework.Graphics/Graphics/Displays/Generic_SPI.cpp

Walkthrough

This change addresses two bugs in the SPI display driver: corrects the sleep delay calculation in ProcessCommand to use only size instead of multiplying by the command byte, and fixes the display attribute assignment to set ShorterSide instead of LongerSide when the display height is non-zero.

Changes

Cohort / File(s) Summary
SPI Display Driver Bug Fixes
src/nanoFramework.Graphics/Graphics/Displays/Generic_SPI.cpp
Fixed sleep delay calculation to use only *size * 10 instead of *cmd * *size * 10. Corrected display attribute assignment to set Attributes.ShorterSide to GenericDriverCommands.Height instead of Attributes.LongerSide.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main changes: fixing issues in the generic SPI graphics setup, which matches the substantive bug fixes documented in the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@josesimoes josesimoes added the Area: Common libs Everything related with common libraries label Apr 6, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes two correctness issues in the Generic_SPI display driver so that generic SPI-based display initialization behaves as intended (sleep delays actually delay, and configured dimensions map to the correct attribute side).

Changes:

  • Fix sleep-delay handling in ProcessCommand() by removing unintended multiplication by the command enum value.
  • Fix SetupDisplayAttributes() to apply configured Height to Attributes.ShorterSide (and remove a stray semicolon).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Common libs Everything related with common libraries Type: bug Type: enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants