Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bmp File Viewer + extras #2119

Merged
merged 30 commits into from
Apr 24, 2024
Merged

Bmp File Viewer + extras #2119

merged 30 commits into from
Apr 24, 2024

Conversation

htotoo
Copy link
Member

@htotoo htotoo commented Apr 22, 2024

This is a big pr, trying to get all the changes, with some documentation.

Got a new View BMPFileViewer. You pass a path to it and it tries to open the BMP file. It goes to full screen mode, and can exit via "enter" key on the keypad.
You can use most features of the new Widget in this app, described bellow.

This View won't replace splashviewer (could, but need to handle the exit part and show a popup if want to set up the splash screen, if the resolution is ok, ... not done this.)

Fileman is modified, so it'll look for the BMP extension. If a BMP file is opened, checks the dir. From the SPLASH dir, it opens the splashviewer, otherwise it opens the new BMPFV app.

File.cpp got 2 new functions, close(), and eof(). This way I can reuse the same BMP object, and open a new file, ...

BMPViewer is a new Widget.
This can load a BMP file and can zoom, and scroll in it. Default to 'enter' key, is to fit zoom, and scroll to 0,0 position. (enter key can be overrided to pass it to parent).
This widget can be any size, and in theory it can handle any size (uint32 x, int32 y) bmp image. (see BMPFile class).

SystemView got a new function set_app_fullscreen(). With this, you can hide / show the status bar. (Don't forget to set it back when you don't need it!)

UsbSerialAsyncmsg::asyncmsg got a float overload.

firmware/common/bmp.hpp got a breaking change! The height of the image can be negative, and this indicates the bottom-up parameter for viewers. ( see https://en.wikipedia.org/wiki/BMP_file_format )

BMPFile class.
With this class, you can open a BMP file, and manipulate it. Or create a new file. Need to mention, the create function is yet limited to top-to bottom format, and 3 byte color depth.
The image then can be expanded by Y axe. With this, you can receive APT, FAX, ... without knowing how long will be the RX.
You must use SEEK() function. The BMP width and height parameter is the number of pixels, but the seek(x,y) coordinates are 0 based. so can seek 0 --> (width-1), 0--> (height-1) px.
read_next_px() reades the pixel and advances to the next if it is not disabled.
write_next_px() also can be called multiple times, and writes px next to each other. But if you use the bottom-up format, don't forget to seek to the right y coordinate after each line.
If you don't set background, the file will contain garbage where there was no px written, but the creation and expansion will be much faster.
Won't load BMP files that has color table (<=8bit, ..). No memory to store and calculate that. Also constant seeking would slow down the process much.

htotoo and others added 28 commits April 18, 2024 12:20
)

* add serial_debug

* not use OSS

* add path print

* add string print and vec

* clean up

* clean up

* format

* add an async blocking bool

* add an async blocking bool - comment

* protect the unexpected tx

* naming

* remove demo code
* add literal str print in asyncmsg

* remove debug things

* accept suggestion per gull

* fix documentary
* WIP

* WIP

* WIP

* Corrected name

* WIP

* WIP

* WIP

* WIP

* Added new calc

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Added debug serial lines

* WIP

* Fixed issue

* Fixed calculation issue

* Added voltage to performance DFU menu

* Added padding function and added voltage to perf menu

* Clean up

* Refactor

* Fixed linting

* Hides voltage if PP does not conatin IC

* WIP showing battery %

* made the percentage a int

* Added % to header

* Removed test UI

* Removed comment

* Added fix for precision too large

* Added fix for precision too large

* Linting
@htotoo htotoo marked this pull request as ready for review April 22, 2024 08:35
@htotoo htotoo marked this pull request as draft April 22, 2024 08:47
@htotoo htotoo marked this pull request as ready for review April 22, 2024 08:50
@htotoo htotoo marked this pull request as draft April 22, 2024 08:58
@htotoo htotoo marked this pull request as ready for review April 22, 2024 09:14
Copy link
Contributor

@NotherNgineer NotherNgineer left a comment

Choose a reason for hiding this comment

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

LGTM

@htotoo htotoo merged commit 06651dc into portapack-mayhem:next Apr 24, 2024
3 checks passed
@htotoo htotoo deleted the bmp branch April 24, 2024 03:18
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.

5 participants