Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DesiQuintans committed Mar 2, 2024
1 parent 4d78c5b commit 3242e3f
Show file tree
Hide file tree
Showing 27 changed files with 453 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distrib
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# adjlcd
AdjLCD - MinUI Tool Paks for controlling Miyoo Mini + Mini Plus screens
# AdjLCD - MinUI Tool Paks for controlling Miyoo Mini + Mini Plus screens



## About

This is a collection of Tool Paks for [MinUI](https://github.com/shauninman/MinUI) (20240128b-0 and later). It adds these tools for controlling the LCD screen of a Miyoo Mini/Mini Plus:

- **AdjLCD - Dimmest** sets the LCD to the lowest luma possible.
- **AdjLCD - Night Filter (Lv 1-5)** replicates the 5-level Blue Light Filter that [XK9274](https://github.com/XK9274) implemented in OnionOS v4.3 (with gracious permission!).
- **AdjLCD - Reset Screen** resets the screen to MinUI's defaults.

Changes to your screen settings persist across reboots thanks to an `auto.sh` boot-up script.

Since the Miyoo doesn't have a real-time clock chip and MinUI doesn't have Wifi support at the time of writing, these tools *do not* support scheduled filters.


## Installation

1. You should have [MinUI](https://github.com/shauninman/MinUI) 20240128b-0 or later installed on your SD card.
2. Download [the latest release of AdjLCD](https://github.com/DesiQuintans/adjlcd/releases/latest).
3. Unzip it to the root folder of your Miyoo's SD card.
- It should place the AdjLCD pak folders into your `Tools/miyoomini/` directory, e.g. `Tools/miyoomini/AdjLCD - Dimmest.pak/`.
- It should also create `.userdata/miyoomini/auto.sh`, which allows your screen settings to persist across reboots.
4. Feel free to delete unwanted .paks.
5. Find and use these tools in your *Tools* directory from the main menu.


If you do not see the *Tools* menu then you may be in Simple Mode; delete the file `/.userdata/shared/enable-simple-mode` to exit Simple Mode. If this file doesn't exist, then you may have extracted the files to the wrong place.


## Preview

### Luma (normal vs dimmest)

![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/luma_normal.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/luma_dimmest.png)

### Night Filter (Normal, then Lv 1 to 5)

![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv0.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv1.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv2.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv3.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv4.png)
![](https://raw.githubusercontent.com/DesiQuintans/adjlcd/main/art/lv5.png)


## License

This is released into the public domain under the Unlicense.
40 changes: 40 additions & 0 deletions _Deploy_toolpaks.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
echo off

REM ---------- Edit these variables as needed. --------------------------------

REM Set the collection name, which is used for the archive name.
set "setname=AdjLCD"

REM ---------- No user-editable variables below. ------------------------------

REM Ask for new version number, which is used to find-replace in files.
set /p ver="Enter a new version number: "



REM Copy target files to temporary folder.
if exist "temp\" rmdir "temp" /s /q
if not exist "temp\" mkdir "temp\"
robocopy src\ temp\ /s

REM Copy the readme up and rename it to .txt (because I've seen people
REM in the retro gaming community get confused expecting .md to be a MegaDrive ROM).
robocopy .\ temp\ README.md
rename temp\README.md AdjLCD-README.txt

REM Do the final zipping.
if not exist "distrib\" mkdir "distrib\"
if exist "distrib\%setname%-%ver%.zip" del distrib\%setname%-%ver%.zip
7z a -tzip -r- distrib\%setname%-%ver%.zip .\temp\*

REM Delete the temporary folder and announce success
REM Wait for a second to wait for the processes to finish.
timeout /t 2 /nobreak
if exist "temp\" rmdir "temp" /s /q

echo.
echo Version v%ver% of %setname% was built.
echo The distributable is at 'distrib/%etname%-%ver%.zip'.
echo.

PAUSE
Binary file added art/AdjLCD Splashes.xcf
Binary file not shown.
Binary file added art/luma_dimmest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/luma_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/lv5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/.userdata/miyoomini/auto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh


# AdjLCD - Persistent screen settings on boot-up.

csc_file=/mnt/SDCARD/.userdata/miyoomini/adjlcd_csc.txt
colortemp_file=/mnt/SDCARD/.userdata/miyoomini/adjlcd_colortemp.txt

if [ -f "$colortemp_file" ]; then
colortemp_call=`cat "$colortemp_file"`
echo "$colortemp_call" > /proc/mi_modules/mi_disp/mi_disp0
fi

if [ -f "$csc_file" ]; then
# colortemp can be called without delay, but csc needs a short wait or else it won't be applied.
# 125000 was too short, 250000 was fine, so I'm giving it 300000 for a safety margin.
usleep 300000
csc_call=`cat "$csc_file"`
echo "$csc_call" > /proc/mi_modules/mi_disp/mi_disp0
fi

# End AdjLCD boot-up section.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions src/Tools/miyoomini/AdjLCD - Dimmest.pak/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

cd "$(dirname "$0")"
bin=/mnt/SDCARD/.system/miyoomini/bin


$bin/show.elf ./dimmest_splash.png
usleep 500000

# By default, luma is set to 45.
# According to reddit posts, Miyoo Minis V1 and V2 had a minimum luma of 6 or else the screen turns off.
lastLuma=45
endLuma=6


for i in $(seq 0 20); do
newLuma=$(( lastLuma + (endLuma - lastLuma) * i / 20 ))
csc_call="csc 0 3 50 50 $newLuma 45 0 0"

# csc [dev] [cscMatrix] [contrast] [hue] [luma] [saturation] [sharpness] [gain]
echo "$csc_call" > /proc/mi_modules/mi_disp/mi_disp0

usleep 50000
done

echo "$csc_call" > /mnt/SDCARD/.userdata/miyoomini/adjlcd_csc.txt
sync

usleep 500000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions src/Tools/miyoomini/AdjLCD - Night Filter Lv1.pak/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh

cd "$(dirname "$0")"
bin=/mnt/SDCARD/.system/miyoomini/bin

$bin/show.elf ./filter_splash.png
usleep 500000

# Assume that we're always starting from a neutral colour temp (easier than trying to save it between sessions).
lastB=128
lastG=128
lastR=128


# These endpoint RGB values are from https://github.com/XK9274 who implemented the Blue Light Filter in OnionOS v4.3.
# They're replicated here with permission; thanks!
# https://github.com/OnionUI/Onion/blob/b5b77c2958dbad6a62e71e33082e9414d9993cad/static/build/.tmp_update/script/blue_light.sh#L21

# Intensity 1
endB=110
endG=125
endR=140

# # Intensity 2
# endB=100
# endG=120
# endR=140

# # Intensity 3
# endB=90
# endG=115
# endR=140

# # Intensity 4
# endB=80
# endG=110
# endR=140

# # Intensity 5
# endB=70
# endG=105
# endR=140


for i in $(seq 0 20); do
newB=$(( lastB + (endB - lastB) * i / 20 ))
newG=$(( lastG + (endG - lastG) * i / 20 ))
newR=$(( lastR + (endR - lastR) * i / 20 ))

colortemp_call="colortemp 0 0 0 0 $newB $newG $newR"

echo "$colortemp_call" > /proc/mi_modules/mi_disp/mi_disp0
usleep 50000
done

echo "$colortemp_call" > /mnt/SDCARD/.userdata/miyoomini/adjlcd_colortemp.txt
sync

usleep 500000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions src/Tools/miyoomini/AdjLCD - Night Filter Lv2.pak/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh

cd "$(dirname "$0")"
bin=/mnt/SDCARD/.system/miyoomini/bin

$bin/show.elf ./filter_splash.png
usleep 500000

# Assume that we're always starting from a neutral colour temp (easier than trying to save it between sessions).
lastB=128
lastG=128
lastR=128


# These endpoint RGB values are from https://github.com/XK9274 who implemented the Blue Light Filter in OnionOS v4.3.
# They're replicated here with permission; thanks!
# https://github.com/OnionUI/Onion/blob/b5b77c2958dbad6a62e71e33082e9414d9993cad/static/build/.tmp_update/script/blue_light.sh#L21

# # Intensity 1
# endB=110
# endG=125
# endR=140

# Intensity 2
endB=100
endG=120
endR=140

# # Intensity 3
# endB=90
# endG=115
# endR=140

# # Intensity 4
# endB=80
# endG=110
# endR=140

# # Intensity 5
# endB=70
# endG=105
# endR=140


for i in $(seq 0 20); do
newB=$(( lastB + (endB - lastB) * i / 20 ))
newG=$(( lastG + (endG - lastG) * i / 20 ))
newR=$(( lastR + (endR - lastR) * i / 20 ))

colortemp_call="colortemp 0 0 0 0 $newB $newG $newR"

echo $colortemp_call > /proc/mi_modules/mi_disp/mi_disp0
usleep 50000
done

echo "$colortemp_call" > /mnt/SDCARD/.userdata/miyoomini/adjlcd_colortemp.txt
sync

usleep 500000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions src/Tools/miyoomini/AdjLCD - Night Filter Lv3.pak/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh

cd "$(dirname "$0")"
bin=/mnt/SDCARD/.system/miyoomini/bin

$bin/show.elf ./filter_splash.png
usleep 500000

# Assume that we're always starting from a neutral colour temp (easier than trying to save it between sessions).
lastB=128
lastG=128
lastR=128


# These endpoint RGB values are from https://github.com/XK9274 who implemented the Blue Light Filter in OnionOS v4.3.
# They're replicated here with permission; thanks!
# https://github.com/OnionUI/Onion/blob/b5b77c2958dbad6a62e71e33082e9414d9993cad/static/build/.tmp_update/script/blue_light.sh#L21

# # Intensity 1
# endB=110
# endG=125
# endR=140

# # Intensity 2
# endB=100
# endG=120
# endR=140

# Intensity 3
endB=90
endG=115
endR=140

# # Intensity 4
# endB=80
# endG=110
# endR=140

# # Intensity 5
# endB=70
# endG=105
# endR=140


for i in $(seq 0 20); do
newB=$(( lastB + (endB - lastB) * i / 20 ))
newG=$(( lastG + (endG - lastG) * i / 20 ))
newR=$(( lastR + (endR - lastR) * i / 20 ))

colortemp_call="colortemp 0 0 0 0 $newB $newG $newR"

echo $colortemp_call > /proc/mi_modules/mi_disp/mi_disp0
usleep 50000
done

echo "$colortemp_call" > /mnt/SDCARD/.userdata/miyoomini/adjlcd_colortemp.txt
sync

usleep 500000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions src/Tools/miyoomini/AdjLCD - Night Filter Lv4.pak/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh

cd "$(dirname "$0")"
bin=/mnt/SDCARD/.system/miyoomini/bin

$bin/show.elf ./filter_splash.png
usleep 500000

# Assume that we're always starting from a neutral colour temp (easier than trying to save it between sessions).
lastB=128
lastG=128
lastR=128


# These endpoint RGB values are from https://github.com/XK9274 who implemented the Blue Light Filter in OnionOS v4.3.
# They're replicated here with permission; thanks!
# https://github.com/OnionUI/Onion/blob/b5b77c2958dbad6a62e71e33082e9414d9993cad/static/build/.tmp_update/script/blue_light.sh#L21

# # Intensity 1
# endB=110
# endG=125
# endR=140

# # Intensity 2
# endB=100
# endG=120
# endR=140

# # Intensity 3
# endB=90
# endG=115
# endR=140

# Intensity 4
endB=80
endG=110
endR=140

# # Intensity 5
# endB=70
# endG=105
# endR=140


for i in $(seq 0 20); do
newB=$(( lastB + (endB - lastB) * i / 20 ))
newG=$(( lastG + (endG - lastG) * i / 20 ))
newR=$(( lastR + (endR - lastR) * i / 20 ))

colortemp_call="colortemp 0 0 0 0 $newB $newG $newR"

echo $colortemp_call > /proc/mi_modules/mi_disp/mi_disp0
usleep 50000
done

echo "$colortemp_call" > /mnt/SDCARD/.userdata/miyoomini/adjlcd_colortemp.txt
sync

usleep 500000
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3242e3f

Please sign in to comment.