Skip to content

Conversation

Dhruv1797
Copy link
Contributor

@Dhruv1797 Dhruv1797 commented Jul 30, 2025

Fixes: #105

https://www.good-display.com/product/426.html

added this E Ink Technology 3.1 inch ePaper Display 320x240 UC8253 SPI E Ink screen, GDEQ031T10 using same the UC8253 display driver.

Here is the demo video:

WhatsApp.Video.2025-07-30.at.5.55.15.PM.mp4

Summary by Sourcery

Add a new EPD implementation for the GDEQ031T10 3.1-inch E Ink display, integrate it into selection utilities and UI, and include its image asset.

New Features:

  • Add support for the GDEQ031T10 3.1-inch E-Paper display using the UC8253 driver

Enhancements:

  • Register GDEQ031T10 in EpdUtils metadata mapping and DisplaySelectionScreen
  • Add image asset path for the new display in asset constants

Copy link
Contributor

sourcery-ai bot commented Jul 30, 2025

Reviewer's Guide

Adds support for the 3.1" GDEQ031T10 ePaper display by introducing a new Epd subclass that reuses the UC8253 driver, registering it in core utilities and the UI selection screen, and defining its image asset.

ER diagram for display image assets

erDiagram
  IMAGE_ASSETS {
    string GDEQ031T10Display
    string epaper37Bwr
    string epaper37Bw
  }
  GDEQ031T10 ||--|| IMAGE_ASSETS : uses
  Gdey037z03 ||--|| IMAGE_ASSETS : uses
  Gdey037z03BW ||--|| IMAGE_ASSETS : uses
Loading

Class diagram for new GDEQ031T10 Epd subclass

classDiagram
  class Epd {
    <<abstract>>
    +int width
    +int height
    +String name
    +String modelId
    +String imgPath
    +List<Color> colors
    +Driver controller
    +List<Function> processingMethods
  }
  class GDEQ031T10 {
    +width = 320
    +height = 240
    +name = "E-Paper 3.1\""
    +modelId = "GDEQ031T10"
    +imgPath = ImageAssets.GDEQ031T10Display
    +colors = [Colors.white, Colors.black]
    +controller = Uc8253()
    +processingMethods: [bwrFloydSteinbergDither, bwrFalseFloydSteinbergDither, bwrStuckiDither, bwrTriColorAtkinsonDither, bwrHalftone, bwrThreshold]
  }
  class Uc8253
  class Driver
  class ImageAssets {
    +GDEQ031T10Display
  }
  class ImageProcessing {
    +bwrFloydSteinbergDither
    +bwrFalseFloydSteinbergDither
    +bwrStuckiDither
    +bwrTriColorAtkinsonDither
    +bwrHalftone
    +bwrThreshold
  }
  Epd <|-- GDEQ031T10
  GDEQ031T10 --> Uc8253 : uses
  GDEQ031T10 --> ImageAssets : uses
  GDEQ031T10 --> ImageProcessing : uses
  Uc8253 --|> Driver
Loading

Class diagram for EpdUtils and DisplaySelectionScreen display registration

classDiagram
  class EpdUtils {
    +static Epd getEpdFromMetadata(Map<String, dynamic>?)
  }
  class DisplaySelectionScreen {
    +List<Epd> displays
  }
  class GDEQ031T10
  class Gdey037z03
  class Gdey037z03BW
  EpdUtils --> GDEQ031T10 : registers
  EpdUtils --> Gdey037z03 : registers
  EpdUtils --> Gdey037z03BW : registers
  DisplaySelectionScreen --> GDEQ031T10 : lists
  DisplaySelectionScreen --> Gdey037z03 : lists
  DisplaySelectionScreen --> Gdey037z03BW : lists
Loading

File-Level Changes

Change Details Files
New GDEQ031T10 Epd subclass implementation
  • Define GDEQ031T10 class extending Epd with width, height, name, modelId, imgPath, and colors
  • Attach Uc8253 driver as the controller
  • Register a suite of image processing methods in the constructor
lib/util/epd/gdeq031t10.dart
Register GDEQ031T10 in utility and UI components
  • Import GDEQ031T10 and add it to the displays list in EpdUtils
  • Add switch case for 'GDEQ031T10' in getEpdFromMetadata
  • Import GDEQ031T10 and include it in the displays array in DisplaySelectionScreen
lib/image_library/utils/epd_utils.dart
lib/view/display_selection_screen.dart
Add image asset constant for the new display
  • Introduce GDEQ031T10Display constant in asset paths
lib/constants/asset_paths.dart

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Dhruv1797 - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `lib/util/epd/gdeq031t10.dart:26` </location>
<code_context>
+  get colors => [Colors.white, Colors.black];
+
+  @override
+  get controller => Uc8253() as Driver;
+
+  GDEQ031T10() {
</code_context>

<issue_to_address>
Avoid unnecessary type casting if Uc8253 already implements Driver.

The explicit cast can be removed for cleaner code and to prevent issues if the class hierarchy changes.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
  @override
  get controller => Uc8253() as Driver;
=======
  @override
  get controller => Uc8253();
>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `lib/util/epd/gdeq031t10.dart:32` </location>
<code_context>
+    processingMethods.add(ImageProcessing.bwrFloydSteinbergDither);
+    processingMethods.add(ImageProcessing.bwrFalseFloydSteinbergDither);
+    processingMethods.add(ImageProcessing.bwrStuckiDither);
+    processingMethods.add(ImageProcessing.bwrTriColorAtkinsonDither);
+    processingMethods.add(ImageProcessing.bwrHalftone);
+    processingMethods.add(ImageProcessing.bwrThreshold);
</code_context>

<issue_to_address>
Review inclusion of tri-color dithering for a two-color display.

Since only black and white are supported, using a tri-color dithering method may be misleading or produce unintended results. Please verify if this method is suitable for a two-color display.
</issue_to_address>

### Comment 3
<location> `lib/constants/asset_paths.dart:7` </location>
<code_context>
   static const String redBoard = 'assets/canvas/red.png';
   static const String blackBoard = 'assets/canvas/black.png';
   static const String epaper37Bwr = 'assets/images/displays/epaper_3.7_bwr.png';
+  static const String GDEQ031T10Display =
+      'assets/images/displays/GDEQ031T10_display.png';
   static const String epaper37Bw = 'assets/images/displays/epaper_3.7_bw.PNG';
   static const String tempIcon = 'assets/icons/icon.png';
</code_context>

<issue_to_address>
Maintain consistent naming conventions for asset constants.

Consider renaming 'GDEQ031T10Display' to 'gdeq031t10Display' to match the existing lowerCamelCase convention and Dart guidelines.

Suggested implementation:

```
  static const String gdeq031t10Display =
      'assets/images/displays/GDEQ031T10_display.png';

```

If `GDEQ031T10Display` is referenced elsewhere in your codebase, update those references to use `gdeq031t10Display` for consistency.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +25 to +26
@override
get controller => Uc8253() as Driver;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Avoid unnecessary type casting if Uc8253 already implements Driver.

The explicit cast can be removed for cleaner code and to prevent issues if the class hierarchy changes.

Suggested change
@override
get controller => Uc8253() as Driver;
@override
get controller => Uc8253();

Comment on lines +7 to +8
static const String GDEQ031T10Display =
'assets/images/displays/GDEQ031T10_display.png';
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Maintain consistent naming conventions for asset constants.

Consider renaming 'GDEQ031T10Display' to 'gdeq031t10Display' to match the existing lowerCamelCase convention and Dart guidelines.

Suggested implementation:

  static const String gdeq031t10Display =
      'assets/images/displays/GDEQ031T10_display.png';

If GDEQ031T10Display is referenced elsewhere in your codebase, update those references to use gdeq031t10Display for consistency.

@Dhruv1797 Dhruv1797 changed the title feat: added E Ink Technology 3.1 inch ePaper Display 320x240 UC8253 SPI E Ink screen, GDEQ031T10 display. feat: added 3.1 inch ePaper Display 320x240 UC8253 SPI E Ink screen, GDEQ031T10 . Jul 30, 2025
Copy link
Contributor

github-actions bot commented Jul 30, 2025

Build Status

Build successful. APKs to test: https://github.com/fossasia/magic-epaper-app/actions/runs/17101633609/artifacts/3809920521.

@hpdang hpdang requested a review from Vishveshwara July 30, 2025 13:40
@hpdang
Copy link
Member

hpdang commented Aug 6, 2025

@Vishveshwara please review this

@hpdang
Copy link
Member

hpdang commented Aug 13, 2025

@Dhruv1797 please address Vish's comments

@Dhruv1797 Dhruv1797 requested a review from Vishveshwara August 18, 2025 09:34
Copy link
Contributor

@Vishveshwara Vishveshwara left a comment

Choose a reason for hiding this comment

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

Looks good to me

@hpdang
Copy link
Member

hpdang commented Aug 20, 2025

@Dhruv1797 resolve conflicts please

@Dhruv1797
Copy link
Contributor Author

@hpdang @Vishveshwara resolves conflicts with main branch. please review it once.

@hpdang hpdang merged commit fe03c39 into fossasia:main Aug 20, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for additional e-paper displays using UC8253 controller
3 participants