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

Add step by step build instruction to readme and fix screen.go file #19

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,45 @@ The software lets you use the keyboard to write and edit text files. It's coded

First you need to download and build the **koxtoolchain** on your development computer. This toolchain, once built, will let you build Go programs that can run on the KOBO.

*TODO : Detailed step to build project*
### Step by step local built

Note: Using WSL (problems with case-sensitivity in memory) or Github Codespace (long built) is a bit tricky. I recommend using a real Ubuntu machine.

1. Clone or download <https://github.com/koreader/koxtoolchain>
2. install its dependancies: `sudo apt-get install build-essential autoconf automake bison flex gawk libtool libtool-bin libncurses-dev curl file git gperf help2man texinfo unzip wget`
3. inside the folder run `./gen-tc.sh kobo` this may take more than 2 hours. (instead you could use the [prebuild version](https://github.com/koreader/koxtoolchain/releases) and unzip, untar in your home folder)
4. run the `source /home/UserName/Downloads/kobowriter-main/refs/x-compile.sh kobo env bare` as recommended at the end of your build
5. Make sure you have golang-go installed on your linux distro (via apt or snap, ...)
6. Clone or download <https://github.com/olup/kobowriter> (you can modify event/key.go for other keyboard layout)
7. inside its main folder, run `make`.
8. Kobowriter will be in the build folder.

### Step by step Codespace built

[Codespace](https://github.com/features/codespaces) is a Ubunutu environement that you can use for free in any of your repo directly on the github website.

1. Fork <https://github.com/koreader/koxtoolchain> (green button)
2. In your new fork, start a new codespace in the GitHub Web UI
3. Once your codespace is runing type in terinal : `cd "$HOME"`
4. then download the ToolChain prebuild by runnung `wget https://github.com/koreader/koxtoolchain/releases/download/2021.12/kobo.zip`
5. then: `unzip kobo.zip`
6. then: `tar -xvzf kobo.tar.gz`
7. You should have the x-tools listed in the repo now, you can check with `ls`
8. Open new terminal and add a file name `x-compile.sh` in your main repo (left column)
9. Open the file and copy paste the content from <https://github.com/koreader/koxtoolchain/blob/master/refs/x-compile.sh> (you can also download that single file and uploaded it to your codespace)
10. Run: `source x-compile.sh kobo env bare`
11. Run: `make` (you can modify event/key.go for other keyboard layout before make)
12. Remove the kobowriter from the .ignore file
13. push your changes in your repo.
14. You new kobowriter will be in the build folder of your repo on the github website!

Notes:

- Note: if [PR](https://github.com/olup/kobowriter/pull/19/commits/cb27c63a494a55f4b287ee2ac03843809a5d734f) has not been accepted or merge, you have to modify the file screener/screen.go with the folowing [lines](https://github.com/olup/kobowriter/blob/cb27c63a494a55f4b287ee2ac03843809a5d734f/screener/screen.go)

- If you have installed XCSoar with the archive tar.gz below, you can swap your custom build kobowriter with the one in the .adds/kobowriter folder. Like this, you can have custom keyboard layout by modifying the event/key.go and build your own kobowriter.

- You can add other app to launch from the XCSoar interface by adding file in the .kobo/XCSoarData/. For example, add a file containing the following line for adding koreader to the tool list in XCSoar

## How to install

Expand Down
11 changes: 3 additions & 8 deletions screener/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ func printDiff(previous matrix.Matrix, next matrix.Matrix, fb *gofbink.FBInk, fo
fb.ClearScreen(&gofbink.FBInkConfig{
IsInverted: next[i][j].IsInverted,
NoRefresh: true,
}, &gofbink.FBInkRect{
Top: uint16(i * ttSize),
Left: uint16(j * ttWidth),
Height: uint16(ttSize),
Width: uint16(ttWidth),
})

fb.PrintOT(string(next[i][j].Content), &gofbink.FBInkOTConfig{
Expand Down Expand Up @@ -122,7 +117,7 @@ func printDiff(previous matrix.Matrix, next matrix.Matrix, fb *gofbink.FBInk, fo
}
}

fb.Refresh(0, 0, 0, 0, &gofbink.FBInkConfig{})
fb.Refresh(0, 0, 0, 0, gofbink.DitherFloydSteingberg ,&gofbink.FBInkConfig{})
}

func (s *Screen) PrintPng(imgBytes []byte, w int, h int, x int, y int) {
Expand Down Expand Up @@ -158,12 +153,12 @@ func (s *Screen) PrintAlert(message string, width int) {
}

func (s *Screen) Clear() {
s.fb.ClearScreen(&gofbink.FBInkConfig{}, &gofbink.FBInkRect{})
s.fb.ClearScreen(&gofbink.FBInkConfig{})
s.presentMatrix = matrix.FillMatrix(s.presentMatrix, ' ')
}

func (s *Screen) ClearFlash() {
s.fb.ClearScreen(&gofbink.FBInkConfig{IsFlashing: true}, &gofbink.FBInkRect{})
s.fb.ClearScreen(&gofbink.FBInkConfig{IsFlashing: true})
s.presentMatrix = matrix.FillMatrix(s.presentMatrix, ' ')
}

Expand Down