Skip to content

feat: quick waveform luts#70

Closed
kienvo wants to merge 1 commit intofossasia:mainfrom
kienvo:waveform-lut
Closed

feat: quick waveform luts#70
kienvo wants to merge 1 commit intofossasia:mainfrom
kienvo:waveform-lut

Conversation

@kienvo
Copy link
Copy Markdown
Member

@kienvo kienvo commented Jun 23, 2025

Resolves #59

Summary by Sourcery

Add quick waveform LUT support to the UC8253 display driver and refactor protocol and driver interfaces to streamline LUT loading and NFC message handling

New Features:

  • Introduce waveform abstraction with Lut, Waveform, and WaveformList classes
  • Implement QuickLut waveform with custom LUT definitions and register it in Uc8253 driver
  • Add setlut and updated init logic in Uc8253 driver to apply the quick waveform LUTs

Enhancements:

  • Refactor Driver interface to expose LUT registers, panel settings, and initialization methods
  • Simplify Protocol class by persisting tagId, unifying writeMsg, and removing redundant tagId parameters

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 23, 2025

Reviewer's Guide

This PR introduces a dedicated waveform abstraction with a new QuickLut subclass, integrates custom quick LUTs and panel settings into the UC8253 driver initialization, extends the Driver interface accordingly, and refactors the Protocol class to centralize NFC messaging and eliminate explicit tagId parameters.

Class diagram for new waveform abstraction and QuickLut

classDiagram
    class Lut {
        +int cmd
        +Uint8List data
    }
    class Waveform {
        <<abstract>>
        +String desc
        +int pll
        +List~Lut~ luts
    }
    class QuickLut {
        +desc
        +pll
        +luts
    }
    Waveform <|-- QuickLut
Loading

Class diagram for updated Driver and Uc8253 integration

classDiagram
    class Driver {
        <<abstract>>
        +String driverName
        +List~int~ transmissionLines
        +int refresh
        +int vcomLut
        +int wwLut
        +int bwLut
        +int wbLut
        +int bbLut
        +int panelSetting
        +int pllControl
        +WaveformList waveforms
        +Future<void> setlut(Protocol, Waveform)
        +Future<void> init(Protocol)
    }
    class Uc8253 {
        +refresh
        +vcomLut
        +wwLut
        +bwLut
        +wbLut
        +bbLut
        +panelSetting
        +pllControl
        +waveforms
        +setlut(Protocol, Waveform)
        +init(Protocol)
    }
    Driver <|-- Uc8253
    Uc8253 --> QuickLut : uses
Loading

Class diagram for Protocol refactor (centralized NFC messaging)

classDiagram
    class Protocol {
        +MagicEpaperFirmware fw
        +Epd epd
        +Duration timeout
        +Uint8List tagId
        +writeMsg(Uint8List)
        +_readDynCfg(int)
        +_writeDynCfg(int, int)
        +hasI2cGatheredMsg()
        +enableEnergyHarvesting()
        +wait4msgGathered()
        +writeFrame(Uint8List, Uint8List, int)
        +writeImage(Uint8List)
    }
Loading

File-Level Changes

Change Details Files
Extract waveform abstraction and define QuickLut with quick LUT data
  • Create a new waveform.dart with Lut and Waveform base classes
  • Implement QuickLut subclass providing five transition LUT definitions and constants
  • Import waveform abstraction into the UC8253 driver and include QuickLut in its waveform list
lib/util/epd/driver/waveform.dart
lib/util/epd/driver/uc8253.dart
Extend Driver interface and enhance UC8253 to support custom LUT integration
  • Add panelSetting, pllControl, vcomLut, wwLut, bwLut, wbLut, bbLut getters and waveforms property to Driver
  • Implement setlut method to apply PLL and all LUT commands via Protocol
  • Adjust init to write panel settings and prepare for quick waveform usage
lib/util/epd/driver/driver.dart
lib/util/epd/driver/uc8253.dart
Refactor Protocol class to centralize message handling and remove explicit tagId usage
  • Move tagId into Protocol state and drop tagId parameters from writeMsg, read/writeDynCfg, hasI2cGatheredMsg, wait4msgGathered
  • Expose writeMsg publicly, simplify _transceive signature, and update all writeMsg/writeFrame calls accordingly
  • Capture tagId from NFC poll once and streamline energy harvesting, init, and refresh sequences
lib/util/protocol.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#59 Create waveform LUTs for UC8253 to enable partial refreshing.

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

@kienvo kienvo force-pushed the waveform-lut branch 4 times, most recently from 85a6ab8 to 8cd5960 Compare June 29, 2025 07:36
@kienvo kienvo marked this pull request as ready for review June 29, 2025 07:37
Copy link
Copy Markdown
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 @kienvo - I've reviewed your changes and they look great!


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.

@kienvo kienvo changed the title WIP: Quick waveform luts feat: quick waveform luts Jun 29, 2025
@kienvo kienvo requested a review from hpdang June 29, 2025 08:02
@hpdang hpdang requested review from CloudyPadmal and marcnause June 30, 2025 08:57
[p.fw.epdSend, 0xCF, 0x8D])); // 480x240, built-in LUTs

// await p.writeMsg(Uint8List.fromList([p.fw.epdSend, 0xEF, 0x8D])); // 480x240, LUTs from register
// await setlut(p, waveforms[0]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commented out code should usually not be committed. Is there a good reason to do it here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It was left here to guide #77 for @Dhruv1797 and @Vishveshwara to work on, otherwise they won't know what 0xEF, 0x8D means.

Copy link
Copy Markdown

@CloudyPadmal CloudyPadmal left a comment

Choose a reason for hiding this comment

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

conflicts

@hpdang
Copy link
Copy Markdown
Member

hpdang commented Jul 3, 2025

@kienvo please resolve conflicts

@kienvo
Copy link
Copy Markdown
Member Author

kienvo commented Jul 3, 2025

@kienvo please resolve conflicts

Merged in #78

@kienvo kienvo closed this Jul 3, 2025
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.

Create waveform LUTs for UC8253

4 participants