Merge branch 'dev' into Short-Detection

This commit is contained in:
discip
2023-07-18 20:21:33 +02:00
committed by GitHub
57 changed files with 1825 additions and 1431 deletions

View File

@@ -26,10 +26,10 @@ jobs:
- name: Git ownership exception - name: Git ownership exception
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
- name: build ${{ matrix.model }} - name: Build ${{ matrix.model }}
run: cd source && ./build.sh -m ${{ matrix.model }} run: cd source && ./build.sh -m ${{ matrix.model }}
- name: copy license text - name: Copy license files
run: | run: |
cp LICENSE source/Hexfile/LICENSE cp LICENSE source/Hexfile/LICENSE
cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md
@@ -55,6 +55,7 @@ jobs:
name: metadata name: metadata
path: source/Hexfile/${{ matrix.model }}.json path: source/Hexfile/${{ matrix.model }}.json
build_multi-lang: build_multi-lang:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
@@ -77,10 +78,10 @@ jobs:
- name: Git ownership exception - name: Git ownership exception
run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE"
- name: build ${{ matrix.model }} - name: Build ${{ matrix.model }}
run: cd source && make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese run: cd source && make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese
- name: copy license text - name: Copy license files
run: | run: |
cp LICENSE source/Hexfile/LICENSE cp LICENSE source/Hexfile/LICENSE
cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md cp scripts/LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md
@@ -106,20 +107,21 @@ jobs:
name: metadata name: metadata
path: source/Hexfile/${{ matrix.model }}_multi-lang.json path: source/Hexfile/${{ matrix.model }}_multi-lang.json
tests: tests:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
image: alpine:3.16 image: alpine:3.16
steps: steps:
- name: deps - name: Install dependencies (apk)
run: apk add --no-cache python3 py3-pip make git bash findutils gcc musl-dev run: apk add --no-cache python3 py3-pip make git bash findutils gcc musl-dev
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- name: install black - name: Install dependencies (python)
run: python3 -m pip install bdflib run: python3 -m pip install bdflib
- name: Run python tests - name: Run python tests
@@ -133,33 +135,49 @@ jobs:
chmod +x brieflz_test.py chmod +x brieflz_test.py
./brieflz_test.py ./brieflz_test.py
check_formatting:
check_c-cpp:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
image: alpine:3.16 image: alpine:3.16
steps: steps:
- name: deps - name: Install dependencies (apk)
run: apk add --no-cache make git diffutils findutils clang-extra-tools
- uses: actions/checkout@v3
with:
submodules: true
- name: Check format style with clang-format
run: cd source && make clean && make check-style
check_python:
runs-on: ubuntu-20.04
container:
image: alpine:3.16
steps:
- name: Install dependencies (apk)
run: apk add --no-cache python3 py3-pip make git black run: apk add --no-cache python3 py3-pip make git black
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- name: install black - name: Install dependencies (python)
run: python3 -m pip install bdflib flake8 run: python3 -m pip install bdflib flake8
- name: Check formatting with clang-format
run: cd source && make clean && make check-style
- name: Check python formatting with black - name: Check python formatting with black
run: black --check Translations run: black --check Translations
- name: Check python with flake8 - name: Check python with flake8
run: flake8 Translations run: flake8 Translations
shellcheck:
name: runner / shellcheck check_shell:
name: check_shell
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -170,3 +188,20 @@ jobs:
reporter: github-pr-review # Change reporter. reporter: github-pr-review # Change reporter.
exclude: "./.git/*" # Optional. exclude: "./.git/*" # Optional.
check_all_files_with_shebangs: "false" # Optional. check_all_files_with_shebangs: "false" # Optional.
check_readme:
runs-on: ubuntu-20.04
container:
image: alpine:3.16
steps:
- name: Install dependencies (apk)
run: apk add --no-cache git
- uses: actions/checkout@v3
with:
submodules: true
- name: Check autogenerated Documentation/README.md
run: /bin/sh ./scripts/deploy.sh docs_readme

3
.gitignore vendored
View File

@@ -212,3 +212,6 @@ TS100/KiCad/TS100.bak
Logo GUI/TS100 Logo Editor/TS100 Logo Editor/obj/ Logo GUI/TS100 Logo Editor/TS100 Logo Editor/obj/
Logo GUI/TS100 Logo Editor/TS100 Logo Editor/bin/ Logo GUI/TS100 Logo Editor/TS100 Logo Editor/bin/
# Tests/linters/sanitizers
source/check-style.log

View File

@@ -9,9 +9,41 @@ This menu is meant to be simple, so it has no fancy GUI animations.
## Menu items ## Menu items
Items are shown in the menu on a single line, so they use short codes and appear in this order: Items are shown in the menu on a single line, so they use short codes.
### Version
There is a static line on top which is presented on every sub-screen and reflects exact version of firmware. Version line on top has the following format - `vX.YYN.[ZZZZZZZZ]`:
- X: major version
- Y: minor version
- N: build type:
- R - git-related **r**elease tag vXX.YY
- T - git-related release **t**ag but version is not vXX.YY !
- D - git-related **d**ev branch
- B - git-related custom **b**ranch
- G - neither above but **g**it-related
- H - build outside of a git tree (i.e. release tarball or **h**omebrew customization without git)
- S - something **s**pecial[^ERR]
- V - something **v**ery special[^ERR]
[^ERR]: `S` and `V` are reserved letters for cases when source of firmware is having very unique origin & configuration
- Z: short commit ID hash with 8 digits generated automatically from git (for git-related build types only)
I.e.:
- `v2.22H` means firmware built locally from tarball with release version of `2.22`
- `v2.22D.1A2B3C4D` means firmware with development version of `2.22` from git `dev` branch & with commit ID `1A2B3C4D` (so it can be traced for debug purposes)
- `v2.22R.5E6F7G8H` means firmware with official release version of `2.22` and it's properly tagged with `v2.22` git tag & with commit ID `5E6F7G8H`'
---
**Additional scroll-able items appear in this order**:
### Date
- This is a date of firmware compilation and it has the following format: `DD-MM-YY` (i.e., `01-07-23` means it has been built in July, 1st, 2023)
### ID ### ID
- This is used by Irons that have an ID and serial number to help check if the iron is authentic. All Pinecil V1 show the same ID number as this is the number programmed into the MCU. - This is used by Irons that have an ID and serial number to help check if the iron is authentic. All Pinecil V1 show the same ID number as this is the number programmed into the MCU.
- The new Pinecil V2 released Aug. 2, 2022 now uses MCU BL706, which enables generating a unique ID/Serial number to every iron. This can be used to verify your [Pinecil authenticity here](https://pinecil.pine64.org/). - The new Pinecil V2 released Aug. 2, 2022 now uses MCU BL706, which enables generating a unique ID/Serial number to every iron. This can be used to verify your [Pinecil authenticity here](https://pinecil.pine64.org/).
@@ -52,7 +84,6 @@ This is the handle temperature or more accurately the reading of the Cold Juncti
This is used for CJC of the tip temperature. This is used for CJC of the tip temperature.
> If CHan is extremely high, this indicates the temperature sensor isn't reading correctly ([see Troubleshooting](https://ralim.github.io/IronOS/Troubleshooting/)) > If CHan is extremely high, this indicates the temperature sensor isn't reading correctly ([see Troubleshooting](https://ralim.github.io/IronOS/Troubleshooting/))
### Max C ### Max C
This indicates the max temperature in °C that the system estimates it can measure the tip reliably to. This indicates the max temperature in °C that the system estimates it can measure the tip reliably to.
@@ -106,6 +137,7 @@ Pressing (`+`) cycles through elements, and (`-`) or unplugging will exit the me
The first page shows the PD negotiation stage number; which can be used for diagnosing if PD is not working. Once negotiation is complete; use (`+`) button to advance to other screens which show the different proposals advertised for voltage and current (State 12 means all is good with the PD charger). The first page shows the PD negotiation stage number; which can be used for diagnosing if PD is not working. Once negotiation is complete; use (`+`) button to advance to other screens which show the different proposals advertised for voltage and current (State 12 means all is good with the PD charger).
#### Below is a method for user modification to convert some early models of Pinecil V1 to safely support 24V on the DC5525 barrel. #### Below is a method for user modification to convert some early models of Pinecil V1 to safely support 24V on the DC5525 barrel.
⚠️ Warning: do this at your own risk, read everything in this document, and go to the [Pine64 community chat](https://wiki.pine64.org/wiki/Pinecil#Community_links) if you desire advice. An incorrect cut of the trace could render the Pinecil non-working. ⚠️ Warning: do this at your own risk, read everything in this document, and go to the [Pine64 community chat](https://wiki.pine64.org/wiki/Pinecil#Community_links) if you desire advice. An incorrect cut of the trace could render the Pinecil non-working.
Background: a simple user modification to the PCB on _some models_ of original V1 allows it to safely use DC barrel 24V by cutting a trace line to the Vbus which held it back to 21V. You can check whether your Pinecil V1 needs the update or can benefit from it by using a hidden trick in the PD debug menu. Background: a simple user modification to the PCB on _some models_ of original V1 allows it to safely use DC barrel 24V by cutting a trace line to the Vbus which held it back to 21V. You can check whether your Pinecil V1 needs the update or can benefit from it by using a hidden trick in the PD debug menu.

29
Documentation/README.md Normal file
View File

@@ -0,0 +1,29 @@
<!-- THIS FILE IS AUTOGENERATED by "scripts/deploy.sh docs_readme" based on nav section in scripts/IronOS-mkdocs.yml config -->
<!-- THIS FILE IS NOT SUPPOSED TO BE EDITED MANUALLY -->
#### This is autogenerated README for brief navigation through github over official documentation for IronOS project
#### This documentation is also available [here online](https://ralim.github.io/IronOS)
- [Home](../Documentation/index.md)
- [Getting Started](../Documentation/GettingStarted.md)
- Flashing the firmware
- [MHP30](../Documentation/Flashing/MHP30.md)
- [Pinecil V1](../Documentation/Flashing/Pinecil%20V1.md)
- [Pinecil V2](../Documentation/Flashing/Pinecil%20V2.md)
- [TS80(P)](../Documentation/Flashing/TS80(P).md)
- [TS100](../Documentation/Flashing/TS100.md)
- Operation
- [Main Menu](../Documentation/Menu.md)
- [Settings](../Documentation/Settings.md)
- [Debug Menu](../Documentation/DebugMenu.md)
- [Power](../Documentation/Power.md)
- [Temperature](../Documentation/Temperature.md)
- [Startup Logo](../Documentation/Logo.md)
- Hardware
- [Hall Sensor (Pinecil)](../Documentation/HallSensor.md)
- [Hardware Notes](../Documentation/Hardware.md)
- [Troubleshooting](../Documentation/Troubleshooting.md)
- [Known Hardware Issues](../Documentation/HardwareIssues.md)
- [Translations](../Documentation/Translation.md)
- [Development](../Documentation/Development.md)

View File

@@ -70,3 +70,21 @@ When on the main screen and having the tip plugged in, the unit shows a pair of
- Holding down the button near the USB end will show the _[debug menu](https://ralim.github.io/IronOS/DebugMenu/)._ In _soldering mode_ this ends the heating. - Holding down the button near the USB end will show the _[debug menu](https://ralim.github.io/IronOS/DebugMenu/)._ In _soldering mode_ this ends the heating.
Operation details are over in the [Menu information.](https://ralim.github.io/IronOS/Menu/) Operation details are over in the [Menu information.](https://ralim.github.io/IronOS/Menu/)
## Feedback
If you would like to:
- report any issue related to IronOS
- request a feature
- provide some suggestion
then you can [fill this form](https://github.com/Ralim/IronOS/issues/new/choose) using github account[^gh].
And if you would like to:
- ask more generic question about IronOS/supported hardware/something you're curious about/etc.
- reach out community to chat with
- share your soldering & DIY skills
- share some interesting finding
- share useful related hardware/software with others
or _anything_ like that, then you can use forum-like [Discussions here](https://github.com/Ralim/IronOS/discussions).
[^gh]: You may need to create it first if you don't have one - it's free of charge.

View File

@@ -49,42 +49,44 @@ MKDOCS_YML=$(CURDIR)/scripts/IronOS-mkdocs.yml
# default target to show help # default target to show help
help: help:
@echo @echo
@echo "Welcome!\nThis is $(INFO)" @echo "Welcome!"
@echo "This is $(INFO)"
@echo "To read more about supported commands (aka \"targets\"), type \"make list\"." @echo "To read more about supported commands (aka \"targets\"), type \"make list\"."
@echo "But if you're impatient then just type \"make docker-build\" - it will:" @echo "But if you're impatient then just type \"make docker-build\" - it will:"
@echo "\t * download, configure & start docker container" @echo " * download, configure & start docker container"
@echo "\t * compile builds of IronOS firmware for all supported models inside that container" @echo " * compile builds of IronOS firmware for all supported models inside that container"
@echo "\t * export generated binaries to \"scripts/ci/artefacts/\" local directory" @echo " * export generated binaries to \"scripts/ci/artefacts/\" local directory"
@echo "Patches are welcome. Happy Hacking!" @echo "Patches are welcome. Happy Hacking!"
@echo @echo
# target to list supported targets with additional info # target to list supported targets with additional info
list: list:
@echo "" @echo
@echo "Supported top-level targets:" @echo "Supported top-level targets:"
@echo "\t * help - shows short basic help" @echo " * help - shows short basic help"
@echo "\t * list - this output" @echo " * list - this output"
@echo "\t * docker-shell - start docker container with shell inside to work on IronOS with all tools needed" @echo " * docker-shell - start docker container with shell inside to work on IronOS with all tools needed"
@echo "\t * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\"" @echo " * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\""
@echo "\t * docker-clean - delete created docker container (but not pre-downloaded data for it)" @echo " * docker-clean - delete created docker container (but not pre-downloaded data for it)"
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file" @echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo" @echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
@echo "\t * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image" @echo " * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
@echo "\t * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image" @echo " * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
@echo "" @echo ""
@echo "NOTES on supported pass-trough targets:" @echo "NOTES on supported pass-trough targets:"
@echo "\t * main Makefile is located in source/ directory and used to build the firmware itself;" @echo " * main Makefile is located in source/ directory and used to build the firmware itself;"
@echo "\t * this top-level Makefile supports to call targets from source/Makefile;" @echo " * this top-level Makefile supports to call targets from source/Makefile;"
@echo "\t * if you set up development environment right on your host, then to build firmware locally, you can just type right from here:" @echo " * if you set up development environment right on your host, then to build firmware locally, you can just type right from here:"
@echo @echo
@echo "\t> make firmware-LANG_ID model=MODEL_ID" @echo " $$ make firmware-LANG_ID model=MODEL_ID"
@echo @echo
@echo "Full list of current supported IDs:" @echo "Full list of current supported IDs:"
@echo "\t * LANG_ID: BE BG CS DA DE EL EN ES FI FR HR HU IT JA_JP LT NB NL_BE NL PL PT RO RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW" @echo " * LANG_ID: BE BG CS DA DE EL EN ES FI FR HR HU IT JA_JP LT NB NL_BE NL PL PT RO RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW"
@echo "\t * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60" @echo " * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60"
@echo @echo
@echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:" @echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:"
@echo "\n\t> make firmware-EN model=TS100" @echo
@echo " $$ make firmware-EN model=TS100"
@echo @echo
# bash one-liner to generate langs for "make list": # bash one-liner to generate langs for "make list":
@@ -132,5 +134,6 @@ clean-build:
# global clean-up target # global clean-up target
clean-full: clean-build docker-clean clean-full: clean-build docker-clean
# phony targets
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full .PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full

0
Translations/brieflz.py Normal file → Executable file
View File

0
Translations/brieflz_test.py Normal file → Executable file
View File

View File

@@ -1263,6 +1263,48 @@ def get_translation_sanity_checks_text(defs: dict) -> str:
return sanity_checks_text return sanity_checks_text
def get_version_suffix(ver) -> str:
suffix = str("")
try:
# Use commands _hoping_ they won't be too new for one environments nor deprecated for another ones:
## - get commit id; --short=8 - the shorted hash with 8 digits (increase/decrease if needed!)
sha_id = f"{subprocess.check_output(['git', 'rev-parse', '--short=8', 'HEAD']).strip().decode('ascii').upper()}"
## - if the exact commit relates to tag, then this command should return one-line tag name:
tag = f"{subprocess.check_output(['git', 'tag', '--points-at', '%s' % sha_id]).strip().decode('ascii')}"
## - get short "traditional" branch name (as in `git branch` for that one with asterisk):
branch = f"{subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip().decode('ascii')}"
if tag and "" != tag:
# _Speculate_ on tag that it's Release...
if ver == tag:
# ... but only if double-check for tag is matched
suffix = "R"
else:
# ... otherwise it's tagged but not a release version!
suffix = "T"
elif branch and "" != branch:
# _Hardcoded_ current main development branch...
if "dev" == branch:
suffix = "D"
# ... or some other branch
else:
suffix = "B"
else:
# Something else but from Git
suffix = "G"
# Attach SHA commit to ID a build since it's from git anyway
suffix += "." + sha_id
except subprocess.CalledProcessError:
# No git tree so _probably_ Homebrew build from source
suffix = "H"
except OSError:
# Something _special_?
suffix = "S"
if "" == suffix:
# Something _very_ special!
suffix = "V"
return suffix
def read_version() -> str: def read_version() -> str:
with open(HERE.parent / "source" / "version.h") as version_file: with open(HERE.parent / "source" / "version.h") as version_file:
for line in version_file: for line in version_file:
@@ -1270,11 +1312,7 @@ def read_version() -> str:
matches = re.findall(r"\"(.+?)\"", line) matches = re.findall(r"\"(.+?)\"", line)
if matches: if matches:
version = matches[0] version = matches[0]
try: version += get_version_suffix(version)
version += f".{subprocess.check_output(['git', 'rev-parse', '--short=7', 'HEAD']).strip().decode('ascii').upper()}"
# --short=7: the shorted hash with 7 digits. Increase/decrease if needed!
except OSError:
version += " git"
return version return version

0
Translations/objcopy.py Normal file → Executable file
View File

View File

@@ -3,9 +3,10 @@ site_name: IronOS
site_url: https://ralim.github.io/IronOS/ site_url: https://ralim.github.io/IronOS/
site_description: "IronOS Open Source Soldering Iron firmware for Miniware and Pinecil" site_description: "IronOS Open Source Soldering Iron firmware for Miniware and Pinecil"
# repo config # Repo config
repo_url: https://github.com/ralim/IronOS/ repo_url: https://github.com/ralim/IronOS/
# Dir & location config
docs_dir: ../Documentation docs_dir: ../Documentation
edit_uri: edit/dev/Documentation/ edit_uri: edit/dev/Documentation/
@@ -16,6 +17,7 @@ theme:
hljs_languages: hljs_languages:
- yaml - yaml
# Navigation structure
nav: nav:
- Home: index.md - Home: index.md
- Getting Started: GettingStarted.md - Getting Started: GettingStarted.md
@@ -47,7 +49,6 @@ plugins:
- awesome-pages - awesome-pages
- git-revision-date - git-revision-date
# Markdown Extensions # Markdown Extensions
markdown_extensions: markdown_extensions:
- attr_list - attr_list

View File

@@ -1,28 +1,34 @@
# Default Reference Distro for development env & deploy:
# * Alpine Linux, version 3.16 *
FROM alpine:3.16 FROM alpine:3.16
LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>" LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
WORKDIR /build # Default current dir when container starts
# Installing the two compilers, python3, python3 pip, clang format WORKDIR /build/source
# Compilders ->gcc-* newlib-*
# Python3 -> py* # Installing the two compilers (ARM & RISCV), python3 & pip, clang tools:
# Misc -> findutils make git ## - compilers: gcc-*, newlib-*
# musl-dev is required for the multi lang firmwares ## - python3: py*, black (required to check Python code formatting)
# clang is required for clang-format (for dev) ## - misc: findutils, make, git, diffutils
## - musl-dev (required for the multi lang firmwares)
## - clang (required for clang-format to check C++ code formatting)
ARG APK_COMPS="gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf \ ARG APK_COMPS="gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf \
newlib-arm-none-eabi" newlib-arm-none-eabi"
ARG APK_PYTHON="python3 py3-pip black" ARG APK_PYTHON="python3 py3-pip black"
ARG APK_MISC="findutils make git" ARG APK_MISC="findutils make git diffutils"
ARG APK_DEV="musl-dev clang bash clang-extra-tools" ARG APK_DEV="musl-dev clang bash clang-extra-tools"
# PIP packages # PIP packages
ARG PIP_PKGS='bdflib' ARG PIP_PKGS='bdflib'
# Install system packages using alpine package manager
RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV} RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV}
# Install Python3 packages # Install Python3 packages as modules using pip
RUN python3 -m pip install ${PIP_PKGS} RUN python3 -m pip install ${PIP_PKGS}
# Git trust
# Git trust to avoid related warning
RUN git config --global --add safe.directory /build/source RUN git config --global --add safe.directory /build/source
COPY . /build/source COPY . /build/source

View File

@@ -3,24 +3,101 @@
# little helper for docker deployment to: # little helper for docker deployment to:
# - start development environment for IronOS ("shell" sub-command) # - start development environment for IronOS ("shell" sub-command)
# - generate full set of builds ("build" sub-command) # - generate full set of builds ("build" sub-command)
# - probably doing some other routines (check source briefly before running undocumented commands!)
#set -x #set -x
#set -e #set -e
### helper functions
# brief help (some supported commands may be missing!)
usage() usage()
{ {
echo -e "\nUsage: ${0} [CMD]\n" echo -e "\nUsage: ${0} [CMD]\n"
echo "CMD:" echo "CMD (docker related):"
echo -e "\tshell - start docker container with shell inside to work on IronOS with all tools needed" echo -e "\tshell - start docker container with shell inside to work on IronOS with all tools needed"
echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware" echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware"
echo -e "\tclean - delete created docker container (but not pre-downloaded data for it)\n" echo -e "\tclean - delete created docker container (but not pre-downloaded data for it)\n"
echo "CMD (helper routines):"
echo -e "\tdocs_readme - generate & OVERWRITE(!) README.md inside Documentation/ based on nav section from mkdocs.yml if it changed\n"
echo -e "\tcheck_style - run clang-format using source/Makefile and generate gcc-compatible error log in source/check-style.log\n"
echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n" echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n"
} }
# Documentation/README.md automagical generation routine
docs_readme()
{
# WARNING: ON RUN Documentaion/README.md MAY BE OVERWRITTEN WITHOUT ANY WARNINGS / CONFIRMATIONS !!!
# Returns:
## 0 to the environment & silence - if there are no any changes in README.md nor updates in mkdocs.yml
## 1 to the environment (as error) & note message - if the update of README.md in repo is required
yml="scripts/IronOS-mkdocs.yml"
md_old="Documentation/README.md"
md_new="Documentation/README"
# ^^^^ hardcoded paths relative to IronOS/ to make this func very trivial
# file overwritten section looks out of style but hoping to make shellcheck happy
cat << EOF > "${md_new}"
<!-- THIS FILE IS AUTOGENERATED by "scripts/deploy.sh docs_readme" based on nav section in ${yml} config -->
<!-- THIS FILE IS NOT SUPPOSED TO BE EDITED MANUALLY -->
#### This is autogenerated README for brief navigation through github over official documentation for IronOS project
#### This documentation is also available [here online](https://ralim.github.io/IronOS)
EOF
# it probably will become unexplainable in a few months but so far it works:
sed '1,/^nav/d; /^ *$/,$d; s,- ,- [,; s,: ,](../Documentation/,; s,.md,.md),; s,:$,],; s,/Pinecil ,/Pinecil%20,; /^ - \[.*\]$/ s,\[,,; s,]$,,' "${yml}" >> "${md_new}"
ret=0
if [ -z "$(diff -q "${md_old}" "${md_new}")" ]; then
rm "${md_new}"
ret=0
else
mv "${md_new}" "${md_old}"
echo ""
echo "${yml} seems to be updated..."
echo "... while ${md_old} is out-of-date!"
echo ""
echo "Please, update ${md_old} in your local working copy by command:"
echo ""
echo " $ ./scripts/deploy.sh docs_readme"
echo ""
echo "And then commit & push changes to update ${md_old} in the repo:"
echo ""
echo " $ git commit ${md_old} -m \"${md_old}: update autogenerated file\" && git push"
echo ""
ret=1
fi;
return "${ret}"
}
# check_style routine for those who too lazy to do it everytime manually
check_style()
{
log="source/check-style.log"
make -C source check-style 2>&1 | tee "${log}"
chmod 0666 "${log}"
sed -i -e 's,\r,,g' "${log}"
return 0
}
### main ### main
docker_conf="Env.yml" docker_conf="Env.yml"
# get absolute location of project root dir to make docker happy with config(s)
# (successfully tested on relatively POSIX-compliant Dash shell)
# this script
script_file="/deploy.sh"
# IronOS/scripts/deploy.sh
script_path="${PWD}"/"${0}"
# IronOS/scripts/
script_dir=${script_path%"${script_file}"}
# IronOS/
root_dir="${script_dir}/.."
# IronOS/Env.yml
docker_file="-f ${root_dir}/${docker_conf}"
# allow providing custom path to docker tool using DOCKER_BIN external env. var. # allow providing custom path to docker tool using DOCKER_BIN external env. var.
# (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh) # (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh)
@@ -42,6 +119,24 @@ if [ -n "${docker_tool}" ] && [ -z "${docker_bin}" ]; then
docker_bin="${docker_tool} compose" docker_bin="${docker_tool} compose"
fi; fi;
# give function argument a name
cmd="${1}"
# if only README.md for Documentation update is required then run it & exit
if [ "docs_readme" = "${cmd}" ]; then
docs_readme
exit "${?}"
fi;
if [ "check_style" = "${cmd}" ]; then
check_style
exit "${?}"
fi;
# if docker is not presented in any way show warning & exit
if [ -z "${docker_bin}" ]; then if [ -z "${docker_bin}" ]; then
echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again." echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again."
exit 1 exit 1
@@ -49,7 +144,6 @@ fi;
# construct command to run # construct command to run
cmd="${1}"
if [ -z "${cmd}" ] || [ "${cmd}" = "shell" ]; then if [ -z "${cmd}" ] || [ "${cmd}" = "shell" ]; then
docker_cmd="run --rm builder" docker_cmd="run --rm builder"
elif [ "${cmd}" = "build" ]; then elif [ "${cmd}" = "build" ]; then
@@ -62,20 +156,6 @@ else
exit 1 exit 1
fi; fi;
# get absolute location of project root dir to make docker happy with config(s)
# (successfully tested on relatively POSIX-compliant Dash shell)
# this script
script_file="/deploy.sh"
# IronOS/scripts/deploy.sh
script_path="${PWD}"/"${0}"
# IronOS/scripts/
script_dir=${script_path%"${script_file}"}
# IronOS/
root_dir="${script_dir}/.."
# IronOS/Env.yml
docker_file="-f ${root_dir}/${docker_conf}"
# change dir to project root dir & run constructed command # change dir to project root dir & run constructed command
cd "${root_dir}" || exit 1 cd "${root_dir}" || exit 1

View File

@@ -19,6 +19,7 @@ AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AllowShortEnumsOnASingleLine: false ### <<< Keeps enums as is
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: false

View File

@@ -154,8 +154,9 @@ static void MX_ADC1_Init(void) {
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_EOSIE)); // Enable end of Normal SET_BIT(hadc1.Instance->CR1, (ADC_CR1_EOSIE)); // Enable end of Normal
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
; ;
}
} }
/* ADC2 init function */ /* ADC2 init function */
@@ -191,8 +192,9 @@ static void MX_ADC2_Init(void) {
HAL_ADC_ConfigChannel(&hadc2, &sConfig); HAL_ADC_ConfigChannel(&hadc2, &sConfig);
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
; ;
}
} }
/* I2C1 init function */ /* I2C1 init function */
static void MX_I2C1_Init(void) { static void MX_I2C1_Init(void) {

View File

@@ -30,9 +30,9 @@ void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
HAL_FLASH_Unlock(); HAL_FLASH_Unlock();
for (uint16_t i = 0; i < (length / 2); i++) { for (uint16_t i = 0; i < (length / 2); i++) {
resetWatchdog(); resetWatchdog();
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]); HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE + (i * sizeof(uint16_t)), data[i]);
} }
HAL_FLASH_Lock(); HAL_FLASH_Lock();
} }
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); } void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t *)SETTINGS_START_PAGE, length); }

View File

@@ -229,8 +229,9 @@ static void MX_ADC1_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected); HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
; ;
}
} }
/* ADC2 init function */ /* ADC2 init function */
@@ -272,8 +273,9 @@ static void MX_ADC2_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected); HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
; ;
}
} }
/* I2C1 init function */ /* I2C1 init function */
static void MX_I2C1_Init(void) { static void MX_I2C1_Init(void) {

View File

@@ -10,7 +10,6 @@
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
#include "string.h" #include "string.h"
void flash_save_buffer(const uint8_t *buffer, const uint16_t length) { void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
FLASH_EraseInitTypeDef pEraseInit; FLASH_EraseInitTypeDef pEraseInit;
pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES; pEraseInit.TypeErase = FLASH_TYPEERASE_PAGES;

View File

@@ -208,9 +208,7 @@ static void prvTaskExitError(void) {
// therefore not output an 'unreachable code' warning for code that appears // therefore not output an 'unreachable code' warning for code that appears
// after it. */ // after it. */
// } // }
for(;;){ for (;;) {}
}
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@@ -13,7 +13,6 @@
#include "configuration.h" #include "configuration.h"
#include <I2C_Wrapper.hpp> #include <I2C_Wrapper.hpp>
void preRToSInit() { void preRToSInit() {
/* Reset of all peripherals, Initializes the Flash interface and the Systick. /* Reset of all peripherals, Initializes the Flash interface and the Systick.
*/ */

View File

@@ -23,7 +23,7 @@ void log_system_state(int32_t PWMWattsx10) {
// Tip_Temp_C,Handle_Temp_C,Output_Power_Wattx10,PWM,Tip_Raw\r\n // Tip_Temp_C,Handle_Temp_C,Output_Power_Wattx10,PWM,Tip_Raw\r\n
// 3+1+3+1+3+1+3+1+5+2 = 23, so sizing at 32 for now // 3+1+3+1+3+1+3+1+5+2 = 23, so sizing at 32 for now
outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n", // outputLength = snprintf(uartOutputBuffer, uartOutputBufferLength, "%lu,%u,%li,%u,%lu\r\n",
TipThermoModel::getTipInC(false), // Tip temp in C TipThermoModel::getTipInC(false), // Tip temp in C
getHandleTemperature(0), // Handle temp in C X10 getHandleTemperature(0), // Handle temp in C X10
PWMWattsx10, // Output Wattage PWMWattsx10, // Output Wattage

View File

@@ -40,18 +40,19 @@ enum class i2c_step {
Wait_stop, // Wait for stop to send and we are done Wait_stop, // Wait for stop to send and we are done
Done, // Finished Done, // Finished
Error_occured, // Error occured on the bus Error_occured, // Error occured on the bus
}; };
struct i2c_state { struct i2c_state {
i2c_step currentStep; i2c_step currentStep;
bool isMemoryWrite; bool isMemoryWrite;
bool wakePart; bool wakePart;
uint8_t deviceAddress; uint8_t deviceAddress;
uint8_t memoryAddress; uint8_t memoryAddress;
uint8_t * buffer; uint8_t *buffer;
uint16_t numberOfBytes; uint16_t numberOfBytes;
dma_parameter_struct dma_init_struct; dma_parameter_struct dma_init_struct;
}; };
i2c_state currentState; i2c_state currentState;
void perform_i2c_step() { void perform_i2c_step() {

View File

@@ -40,7 +40,8 @@ bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_b
i2cCfg.data = p_buffer; i2cCfg.data = p_buffer;
i2cCfg.subAddrSize = 1; // one byte address i2cCfg.subAddrSize = 1; // one byte address
taskENTER_CRITICAL(); taskENTER_CRITICAL();
/* --------------- */
err = I2C_MasterReceiveBlocking(I2C0_ID, &i2cCfg); err = I2C_MasterReceiveBlocking(I2C0_ID, &i2cCfg);
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
bool res = err == SUCCESS; bool res = err == SUCCESS;
@@ -63,7 +64,9 @@ bool FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress, uint8_t *p_bu
i2cCfg.dataSize = number_of_byte; i2cCfg.dataSize = number_of_byte;
i2cCfg.data = p_buffer; i2cCfg.data = p_buffer;
i2cCfg.subAddrSize = 1; // one byte address i2cCfg.subAddrSize = 1; // one byte address
taskENTER_CRITICAL();
taskENTER_CRITICAL();
/* --------------- */
err = I2C_MasterSendBlocking(I2C0_ID, &i2cCfg); err = I2C_MasterSendBlocking(I2C0_ID, &i2cCfg);
taskEXIT_CRITICAL(); taskEXIT_CRITICAL();
bool res = err == SUCCESS; bool res = err == SUCCESS;

View File

@@ -80,7 +80,7 @@
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) #if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
#endif #endif
/* Block sizes must not get too small. */ /* Block sizes must not get too small. */
@@ -91,9 +91,8 @@
/* Define the linked list structure. This is used to link free blocks in order /* Define the linked list structure. This is used to link free blocks in order
* of their memory address. */ * of their memory address. */
typedef struct A_BLOCK_LINK typedef struct A_BLOCK_LINK {
{ struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
struct A_BLOCK_LINK * pxNextFreeBlock; /*<< The next free block in the list. */
size_t xBlockSize; /*<< The size of the free block. */ size_t xBlockSize; /*<< The size of the free block. */
} BlockLink_t; } BlockLink_t;
@@ -105,7 +104,7 @@ typedef struct A_BLOCK_LINK
* the block in front it and/or the block behind it if the memory blocks are * the block in front it and/or the block behind it if the memory blocks are
* adjacent to each other. * adjacent to each other.
*/ */
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ); static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@@ -114,7 +113,7 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert );
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK ); static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
/* Create a couple of list links to mark the start and end of the list. */ /* Create a couple of list links to mark the start and end of the list. */
static BlockLink_t xStart, * pxEnd = NULL; static BlockLink_t xStart, *pxEnd = NULL;
/* Keeps track of the number of calls to allocate and free memory as well as the /* Keeps track of the number of calls to allocate and free memory as well as the
* number of free bytes remaining, but says nothing about fragmentation. */ * number of free bytes remaining, but says nothing about fragmentation. */
@@ -131,10 +130,9 @@ static size_t xBlockAllocatedBit = 0;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void * pvPortMalloc( size_t xWantedSize ) void *pvPortMalloc( size_t xWantedSize ) {
{ BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
BlockLink_t * pxBlock, * pxPreviousBlock, * pxNewBlockLink; void *pvReturn = NULL;
void * pvReturn = NULL;
/* The heap must be initialised before the first call to /* The heap must be initialised before the first call to
* prvPortMalloc(). */ * prvPortMalloc(). */
@@ -146,48 +144,38 @@ void * pvPortMalloc( size_t xWantedSize )
* set. The top bit of the block size member of the BlockLink_t structure * set. The top bit of the block size member of the BlockLink_t structure
* is used to determine who owns the block - the application or the * is used to determine who owns the block - the application or the
* kernel, so it must be free. */ * kernel, so it must be free. */
if( ( xWantedSize & xBlockAllocatedBit ) == 0 ) if ( ( xWantedSize & xBlockAllocatedBit ) == 0 ) {
{
/* The wanted size is increased so it can contain a BlockLink_t /* The wanted size is increased so it can contain a BlockLink_t
* structure in addition to the requested amount of bytes. */ * structure in addition to the requested amount of bytes. */
if( xWantedSize > 0 ) if ( xWantedSize > 0 ) {
{
xWantedSize += xHeapStructSize; xWantedSize += xHeapStructSize;
/* Ensure that blocks are always aligned to the required number /* Ensure that blocks are always aligned to the required number
* of bytes. */ * of bytes. */
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 ) if ( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 ) {
{
/* Byte alignment required. */ /* Byte alignment required. */
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) ) if ( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) ) {
{
/* Traverse the list from the start (lowest address) block until /* Traverse the list from the start (lowest address) block until
* one of adequate size is found. */ * one of adequate size is found. */
pxPreviousBlock = &xStart; pxPreviousBlock = &xStart;
pxBlock = xStart.pxNextFreeBlock; pxBlock = xStart.pxNextFreeBlock;
while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) while ( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) {
{
pxPreviousBlock = pxBlock; pxPreviousBlock = pxBlock;
pxBlock = pxBlock->pxNextFreeBlock; pxBlock = pxBlock->pxNextFreeBlock;
} }
/* If the end marker was reached then a block of adequate size /* If the end marker was reached then a block of adequate size
* was not found. */ * was not found. */
if( pxBlock != pxEnd ) if ( pxBlock != pxEnd ) {
{
/* Return the memory space pointed to - jumping over the /* Return the memory space pointed to - jumping over the
* BlockLink_t structure at its start. */ * BlockLink_t structure at its start. */
pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + xHeapStructSize ); pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + xHeapStructSize );
@@ -198,8 +186,7 @@ void * pvPortMalloc( size_t xWantedSize )
/* If the block is larger than required it can be split into /* If the block is larger than required it can be split into
* two. */ * two. */
if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) if ( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) {
{
/* This block is to be split into two. Create a new /* This block is to be split into two. Create a new
* block following the number of bytes requested. The void * block following the number of bytes requested. The void
* cast is used to prevent byte alignment warnings from the * cast is used to prevent byte alignment warnings from the
@@ -213,20 +200,15 @@ void * pvPortMalloc( size_t xWantedSize )
/* Insert the new block into the list of free blocks. */ /* Insert the new block into the list of free blocks. */
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
xFreeBytesRemaining -= pxBlock->xBlockSize; xFreeBytesRemaining -= pxBlock->xBlockSize;
if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining ) if ( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining ) {
{
xMinimumEverFreeBytesRemaining = xFreeBytesRemaining; xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
@@ -235,19 +217,13 @@ void * pvPortMalloc( size_t xWantedSize )
pxBlock->xBlockSize |= xBlockAllocatedBit; pxBlock->xBlockSize |= xBlockAllocatedBit;
pxBlock->pxNextFreeBlock = NULL; pxBlock->pxNextFreeBlock = NULL;
xNumberOfSuccessfulAllocations++; xNumberOfSuccessfulAllocations++;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
@@ -255,31 +231,26 @@ void * pvPortMalloc( size_t xWantedSize )
} }
( void ) xTaskResumeAll(); ( void ) xTaskResumeAll();
#if ( configUSE_MALLOC_FAILED_HOOK == 1 ) #if ( configUSE_MALLOC_FAILED_HOOK == 1 )
{
if( pvReturn == NULL )
{ {
if ( pvReturn == NULL ) {
extern void vApplicationMallocFailedHook( void ); extern void vApplicationMallocFailedHook( void );
vApplicationMallocFailedHook(); vApplicationMallocFailedHook();
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} }
#endif /* if ( configUSE_MALLOC_FAILED_HOOK == 1 ) */ #endif /* if ( configUSE_MALLOC_FAILED_HOOK == 1 ) */
return pvReturn; return pvReturn;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vPortFree( void * pv ) void vPortFree( void *pv ) {
{ uint8_t *puc = ( uint8_t * ) pv;
uint8_t * puc = ( uint8_t * ) pv; BlockLink_t *pxLink;
BlockLink_t * pxLink;
if( pv != NULL ) if ( pv != NULL ) {
{
/* The memory being freed will have an BlockLink_t structure immediately /* The memory being freed will have an BlockLink_t structure immediately
* before it. */ * before it. */
puc -= xHeapStructSize; puc -= xHeapStructSize;
@@ -291,10 +262,8 @@ void vPortFree( void * pv )
configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ); configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
configASSERT( pxLink->pxNextFreeBlock == NULL ); configASSERT( pxLink->pxNextFreeBlock == NULL );
if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ) if ( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ) {
{ if ( pxLink->pxNextFreeBlock == NULL ) {
if( pxLink->pxNextFreeBlock == NULL )
{
/* The block is being returned to the heap - it is no longer /* The block is being returned to the heap - it is no longer
* allocated. */ * allocated. */
pxLink->xBlockSize &= ~xBlockAllocatedBit; pxLink->xBlockSize &= ~xBlockAllocatedBit;
@@ -308,41 +277,29 @@ void vPortFree( void * pv )
xNumberOfSuccessfulFrees++; xNumberOfSuccessfulFrees++;
} }
( void ) xTaskResumeAll(); ( void ) xTaskResumeAll();
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
size_t xPortGetFreeHeapSize( void ) size_t xPortGetFreeHeapSize( void ) { return xFreeBytesRemaining; }
{
return xFreeBytesRemaining;
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
size_t xPortGetMinimumEverFreeHeapSize( void ) size_t xPortGetMinimumEverFreeHeapSize( void ) { return xMinimumEverFreeBytesRemaining; }
{
return xMinimumEverFreeBytesRemaining;
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ) static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ) {
{ BlockLink_t *pxIterator;
BlockLink_t * pxIterator; uint8_t *puc;
uint8_t * puc;
/* Iterate through the list until a block is found that has a higher address /* Iterate through the list until a block is found that has a higher address
* than the block being inserted. */ * than the block being inserted. */
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) for ( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) {
{
/* Nothing to do here, just iterate to the right position. */ /* Nothing to do here, just iterate to the right position. */
} }
@@ -350,13 +307,10 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
* make a contiguous block of memory? */ * make a contiguous block of memory? */
puc = ( uint8_t * ) pxIterator; puc = ( uint8_t * ) pxIterator;
if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) if ( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) {
{
pxIterator->xBlockSize += pxBlockToInsert->xBlockSize; pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
pxBlockToInsert = pxIterator; pxBlockToInsert = pxIterator;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
@@ -364,21 +318,15 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
* make a contiguous block of memory? */ * make a contiguous block of memory? */
puc = ( uint8_t * ) pxBlockToInsert; puc = ( uint8_t * ) pxBlockToInsert;
if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) if ( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) {
{ if ( pxIterator->pxNextFreeBlock != pxEnd ) {
if( pxIterator->pxNextFreeBlock != pxEnd )
{
/* Form one big block from the two blocks. */ /* Form one big block from the two blocks. */
pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize; pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize;
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock; pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock;
} } else {
else
{
pxBlockToInsert->pxNextFreeBlock = pxEnd; pxBlockToInsert->pxNextFreeBlock = pxEnd;
} }
} } else {
else
{
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
} }
@@ -386,40 +334,34 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
* before and the block after, then it's pxNextFreeBlock pointer will have * before and the block after, then it's pxNextFreeBlock pointer will have
* already been set, and should not be set here as that would make it point * already been set, and should not be set here as that would make it point
* to itself. */ * to itself. */
if( pxIterator != pxBlockToInsert ) if ( pxIterator != pxBlockToInsert ) {
{
pxIterator->pxNextFreeBlock = pxBlockToInsert; pxIterator->pxNextFreeBlock = pxBlockToInsert;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) {
{ BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
BlockLink_t * pxFirstFreeBlockInRegion = NULL, * pxPreviousFreeBlock;
size_t xAlignedHeap; size_t xAlignedHeap;
size_t xTotalRegionSize, xTotalHeapSize = 0; size_t xTotalRegionSize, xTotalHeapSize = 0;
BaseType_t xDefinedRegions = 0; BaseType_t xDefinedRegions = 0;
size_t xAddress; size_t xAddress;
const HeapRegion_t * pxHeapRegion; const HeapRegion_t *pxHeapRegion;
/* Can only call once! */ /* Can only call once! */
configASSERT( pxEnd == NULL ); configASSERT( pxEnd == NULL );
pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] ); pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
while( pxHeapRegion->xSizeInBytes > 0 ) while ( pxHeapRegion->xSizeInBytes > 0 ) {
{
xTotalRegionSize = pxHeapRegion->xSizeInBytes; xTotalRegionSize = pxHeapRegion->xSizeInBytes;
/* Ensure the heap region starts on a correctly aligned boundary. */ /* Ensure the heap region starts on a correctly aligned boundary. */
xAddress = ( size_t ) pxHeapRegion->pucStartAddress; xAddress = ( size_t ) pxHeapRegion->pucStartAddress;
if( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) if ( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) {
{
xAddress += ( portBYTE_ALIGNMENT - 1 ); xAddress += ( portBYTE_ALIGNMENT - 1 );
xAddress &= ~portBYTE_ALIGNMENT_MASK; xAddress &= ~portBYTE_ALIGNMENT_MASK;
@@ -430,15 +372,12 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
xAlignedHeap = xAddress; xAlignedHeap = xAddress;
/* Set xStart if it has not already been set. */ /* Set xStart if it has not already been set. */
if( xDefinedRegions == 0 ) if ( xDefinedRegions == 0 ) {
{
/* xStart is used to hold a pointer to the first item in the list of /* xStart is used to hold a pointer to the first item in the list of
* free blocks. The void cast is used to prevent compiler warnings. */ * free blocks. The void cast is used to prevent compiler warnings. */
xStart.pxNextFreeBlock = ( BlockLink_t * ) xAlignedHeap; xStart.pxNextFreeBlock = ( BlockLink_t * ) xAlignedHeap;
xStart.xBlockSize = ( size_t ) 0; xStart.xBlockSize = ( size_t ) 0;
} } else {
else
{
/* Should only get here if one region has already been added to the /* Should only get here if one region has already been added to the
* heap. */ * heap. */
configASSERT( pxEnd != NULL ); configASSERT( pxEnd != NULL );
@@ -456,6 +395,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
xAddress = xAlignedHeap + xTotalRegionSize; xAddress = xAlignedHeap + xTotalRegionSize;
xAddress -= xHeapStructSize; xAddress -= xHeapStructSize;
xAddress &= ~portBYTE_ALIGNMENT_MASK; xAddress &= ~portBYTE_ALIGNMENT_MASK;
pxEnd = ( BlockLink_t * ) xAddress; pxEnd = ( BlockLink_t * ) xAddress;
pxEnd->xBlockSize = 0; pxEnd->xBlockSize = 0;
pxEnd->pxNextFreeBlock = NULL; pxEnd->pxNextFreeBlock = NULL;
@@ -469,8 +409,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
/* If this is not the first region that makes up the entire heap space /* If this is not the first region that makes up the entire heap space
* then link the previous region to this region. */ * then link the previous region to this region. */
if( pxPreviousFreeBlock != NULL ) if ( pxPreviousFreeBlock != NULL ) {
{
pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion; pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion;
} }
@@ -492,9 +431,8 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vPortGetHeapStats( HeapStats_t * pxHeapStats ) void vPortGetHeapStats( HeapStats_t *pxHeapStats ) {
{ BlockLink_t *pxBlock;
BlockLink_t * pxBlock;
size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */ size_t xBlocks = 0, xMaxSize = 0, xMinSize = portMAX_DELAY; /* portMAX_DELAY used as a portable way of getting the maximum value. */
vTaskSuspendAll(); vTaskSuspendAll();
@@ -503,26 +441,21 @@ void vPortGetHeapStats( HeapStats_t * pxHeapStats )
/* pxBlock will be NULL if the heap has not been initialised. The heap /* pxBlock will be NULL if the heap has not been initialised. The heap
* is initialised automatically when the first allocation is made. */ * is initialised automatically when the first allocation is made. */
if( pxBlock != NULL ) if ( pxBlock != NULL ) {
{ do {
do
{
/* Increment the number of blocks and record the largest block seen /* Increment the number of blocks and record the largest block seen
* so far. */ * so far. */
xBlocks++; xBlocks++;
if( pxBlock->xBlockSize > xMaxSize ) if ( pxBlock->xBlockSize > xMaxSize ) {
{
xMaxSize = pxBlock->xBlockSize; xMaxSize = pxBlock->xBlockSize;
} }
/* Heap five will have a zero sized block at the end of each /* Heap five will have a zero sized block at the end of each
* each region - the block is only used to link to the next * each region - the block is only used to link to the next
* heap region so it not a real block. */ * heap region so it not a real block. */
if( pxBlock->xBlockSize != 0 ) if ( pxBlock->xBlockSize != 0 ) {
{ if ( pxBlock->xBlockSize < xMinSize ) {
if( pxBlock->xBlockSize < xMinSize )
{
xMinSize = pxBlock->xBlockSize; xMinSize = pxBlock->xBlockSize;
} }
} }
@@ -530,7 +463,7 @@ void vPortGetHeapStats( HeapStats_t * pxHeapStats )
/* Move to the next block in the chain until the last block is /* Move to the next block in the chain until the last block is
* reached. */ * reached. */
pxBlock = pxBlock->pxNextFreeBlock; pxBlock = pxBlock->pxNextFreeBlock;
} while( pxBlock != pxEnd ); } while ( pxBlock != pxEnd );
} }
} }
( void ) xTaskResumeAll(); ( void ) xTaskResumeAll();

View File

@@ -1,45 +1,38 @@
#include <errno.h> #include "ble.h"
#include <stdbool.h>
#include <stdlib.h>
#include <FreeRTOS.h>
#include "bflb_platform.h"
#include <task.h>
#include "BSP.h" #include "BSP.h"
#include "bflb_platform.h"
#include "bl702_glb.h"
#include "ble_characteristics.h"
#include "ble_peripheral.h"
#include "bluetooth.h" #include "bluetooth.h"
#include "conn.h" #include "conn.h"
#include "gatt.h" #include "gatt.h"
#include "hci_core.h"
#include "uuid.h"
#include "ble_peripheral.h"
#include "log.h"
#include "bl702_glb.h"
#include "ble_characteristics.h"
#include "hal_clock.h" #include "hal_clock.h"
#include "ble.h" #include "hci_core.h"
#include "log.h"
#include "uuid.h"
#include <FreeRTOS.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <task.h>
void ble_stack_start(void) {
void ble_stack_start(void)
{
MSG("BLE Starting\n"); MSG("BLE Starting\n");
GLB_Set_EM_Sel(GLB_EM_8KB); GLB_Set_EM_Sel(GLB_EM_8KB);
ble_controller_init(configMAX_PRIORITIES - 1); ble_controller_init(configMAX_PRIORITIES - 1);
// // Initialize BLE Host stack // Initialize BLE Host stack
hci_driver_init(); hci_driver_init();
bt_enable(bt_enable_cb); bt_enable(bt_enable_cb);
MSG("BLE Starting...Done\n"); MSG("BLE Starting...Done\n");
} }
/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the /* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory() application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */ to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize) {
{
/* If the buffers to be provided to the Timer task are declared inside this /* If the buffers to be provided to the Timer task are declared inside this
function then they must be declared static - otherwise they will be allocated on function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */ the stack and so not exists after this function exits. */
@@ -59,12 +52,10 @@ void vApplicationGetTimerTaskMemory(StaticTask_t **ppxTimerTaskTCBBuffer, StackT
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
} }
void vApplicationMallocFailedHook(void) {
void vApplicationMallocFailedHook(void)
{
MSG("vApplicationMallocFailedHook\r\n"); MSG("vApplicationMallocFailedHook\r\n");
while (1) while (1) {
; ;
}
} }

View File

@@ -113,8 +113,9 @@ int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_att
// hall sensor // hall sensor
{ {
int16_t hallEffectStrength = getRawHallEffect(); int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0) if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength; hallEffectStrength = -hallEffectStrength;
}
temp = hallEffectStrength; temp = hallEffectStrength;
memcpy(buf, &temp, sizeof(temp)); memcpy(buf, &temp, sizeof(temp));
return sizeof(temp); return sizeof(temp);

View File

@@ -258,7 +258,9 @@ static struct bt_gatt_attr ble_attrs_declaration[] = {
NAME NAME
get_attr get_attr
*/ */
struct bt_gatt_attr *get_attr(u8_t index) { return &ble_attrs_declaration[index]; } struct bt_gatt_attr *get_attr(u8_t index) {
return &ble_attrs_declaration[index];
}
static struct bt_gatt_service ble_tp_server = BT_GATT_SERVICE(ble_attrs_declaration); static struct bt_gatt_service ble_tp_server = BT_GATT_SERVICE(ble_attrs_declaration);

View File

@@ -10,6 +10,7 @@ NOTES
#ifndef _BLE_TP_SVC_H_ #ifndef _BLE_TP_SVC_H_
#define _BLE_TP_SVC_H_ #define _BLE_TP_SVC_H_
#include "types.h"
#include "ble_config.h" #include "ble_config.h"
// read value handle offset 2 // read value handle offset 2

View File

@@ -206,8 +206,9 @@ static void MX_ADC1_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected); HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq SET_BIT(hadc1.Instance->CR1, (ADC_CR1_JEOCIE)); // Enable end of injected conv irq
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK) {
; ;
}
} }
/* ADC2 init function */ /* ADC2 init function */
@@ -244,8 +245,9 @@ static void MX_ADC2_Init(void) {
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected); HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
// Run ADC internal calibration // Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK) {
; ;
}
} }
/* I2C1 init function */ /* I2C1 init function */
static void MX_I2C1_Init(void) { static void MX_I2C1_Init(void) {

View File

@@ -30,10 +30,9 @@ void flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
HAL_FLASH_Unlock(); HAL_FLASH_Unlock();
for (uint16_t i = 0; i < (length / 2); i++) { for (uint16_t i = 0; i < (length / 2); i++) {
resetWatchdog(); resetWatchdog();
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE+ (i*sizeof(uint16_t)), data[i]); HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, SETTINGS_START_PAGE + (i * sizeof(uint16_t)), data[i]);
} }
HAL_FLASH_Lock(); HAL_FLASH_Lock();
} }
void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t*)SETTINGS_START_PAGE, length); } void flash_read_buffer(uint8_t *buffer, const uint16_t length) { memcpy(buffer, (uint8_t *)SETTINGS_START_PAGE, length); }

View File

@@ -208,9 +208,7 @@ static void prvTaskExitError(void) {
// therefore not output an 'unreachable code' warning for code that appears // therefore not output an 'unreachable code' warning for code that appears
// after it. */ // after it. */
// } // }
for(;;){ for (;;) {}
}
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@@ -481,6 +481,23 @@ void OLED::printWholeScreen(const char *string) {
} }
} }
// Print *F or *C - in font style of Small, Large (by default) or Extra based on input arg
void OLED::printSymbolDeg(const FontStyle fontStyle) {
switch (fontStyle) {
case FontStyle::EXTRAS:
// Picks *F or *C in ExtraFontChars[] from Font.h
OLED::drawSymbol(getSettingValue(SettingsOptions::TemperatureInF) ? 0 : 1);
break;
case FontStyle::LARGE:
OLED::print(getSettingValue(SettingsOptions::TemperatureInF) ? LargeSymbolDegF : LargeSymbolDegC, fontStyle);
break;
case FontStyle::SMALL:
default:
OLED::print(getSettingValue(SettingsOptions::TemperatureInF) ? SmallSymbolDegF : SmallSymbolDegC, fontStyle);
break;
}
}
inline void stripLeaderZeros(char *buffer, uint8_t places) { inline void stripLeaderZeros(char *buffer, uint8_t places) {
// Removing the leading zero's by swapping them to SymbolSpace // Removing the leading zero's by swapping them to SymbolSpace
// Stop 1 short so that we dont blank entire number if its zero // Stop 1 short so that we dont blank entire number if its zero

View File

@@ -103,7 +103,8 @@ public:
} }
} }
static void setRotation(bool leftHanded); // Set the rotation for the screen // Set the rotation for the screen
static void setRotation(bool leftHanded);
// Get the current rotation of the LCD // Get the current rotation of the LCD
static bool getRotation() { static bool getRotation() {
#ifdef OLED_FLIP #ifdef OLED_FLIP
@@ -115,8 +116,11 @@ public:
static void setBrightness(uint8_t contrast); static void setBrightness(uint8_t contrast);
static void setInverseDisplay(bool inverted); static void setInverseDisplay(bool inverted);
static int16_t getCursorX() { return cursor_x; } static int16_t getCursorX() { return cursor_x; }
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255); // Draw a string to the current location, with selected font; optionally - with MAX length only // Draw a string to the current location, with selected font; optionally - with MAX length only
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255);
static void printWholeScreen(const char *string); static void printWholeScreen(const char *string);
// Print *F or *C - in font style of Small, Large (by default) or Extra based on input arg
static void printSymbolDeg(FontStyle fontStyle = FontStyle::LARGE);
// Set the cursor location by pixels // Set the cursor location by pixels
static void setCursor(int16_t x, int16_t y) { static void setCursor(int16_t x, int16_t y) {
cursor_x = x; cursor_x = x;

View File

@@ -20,8 +20,7 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp
/* place for user code */ /* place for user code */
} }
void vApplicationStackOverflowHook( TaskHandle_t xTask, void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
char * pcTaskName ) {
(void)xTask; (void)xTask;
(void)pcTaskName; (void)pcTaskName;

View File

@@ -11,29 +11,34 @@
#include "cmsis_os.h" #include "cmsis_os.h"
#include "configuration.h" #include "configuration.h"
#include "stdint.h" #include "stdint.h"
enum QCState { enum QCState {
NOT_STARTED = 0, // Have not checked NOT_STARTED = 0, // Have not checked
QC_3 = 1, QC_3 = 1,
QC_2 = 2, QC_2 = 2,
NO_QC = 3, NO_QC = 3,
}; };
void QC_Seek9V() { void QC_Seek9V() {
QC_DNegZero_Six(); QC_DNegZero_Six();
QC_DPlusThree_Three(); QC_DPlusThree_Three();
} }
void QC_Seek12V() { void QC_Seek12V() {
QC_DNegZero_Six(); QC_DNegZero_Six();
QC_DPlusZero_Six(); QC_DPlusZero_Six();
} }
void QC_Seek20V() { void QC_Seek20V() {
QC_DNegThree_Three(); QC_DNegThree_Three();
QC_DPlusThree_Three(); QC_DPlusThree_Three();
} }
void QC_SeekContMode() { void QC_SeekContMode() {
QC_DNegThree_Three(); QC_DNegThree_Three();
QC_DPlusZero_Six(); QC_DPlusZero_Six();
} }
void QC_SeekContPlus() { void QC_SeekContPlus() {
QC_SeekContMode(); QC_SeekContMode();
osDelay(30); osDelay(30);
@@ -41,6 +46,7 @@ void QC_SeekContPlus() {
osDelay(10); osDelay(10);
QC_SeekContMode(); QC_SeekContMode();
} }
void QC_SeekContNeg() { void QC_SeekContNeg() {
QC_SeekContMode(); QC_SeekContMode();
osDelay(30); osDelay(30);
@@ -48,17 +54,21 @@ void QC_SeekContNeg() {
osDelay(10); osDelay(10);
QC_SeekContMode(); QC_SeekContMode();
} }
QCState QCMode = QCState::NOT_STARTED; QCState QCMode = QCState::NOT_STARTED;
uint8_t QCTries = 0; uint8_t QCTries = 0;
void seekQC(int16_t Vx10, uint16_t divisor) { void seekQC(int16_t Vx10, uint16_t divisor) {
if (QCMode == QCState::NOT_STARTED) if (QCMode == QCState::NOT_STARTED) {
startQC(divisor); startQC(divisor);
}
if (Vx10 < 40) // Bail out if less than 4V if (Vx10 < 40) { // Bail out if less than 4V
return; return;
}
if (xTaskGetTickCount() < TICKS_SECOND) if (xTaskGetTickCount() < TICKS_SECOND) {
return; return;
}
// Seek the QC to the Voltage given if this adapter supports continuous mode // Seek the QC to the Voltage given if this adapter supports continuous mode
// try and step towards the wanted value // try and step towards the wanted value
@@ -87,8 +97,9 @@ void seekQC(int16_t Vx10, uint16_t divisor) {
// Re-measure // Re-measure
/* Disabled due to nothing to test and code space of around 1k*/ /* Disabled due to nothing to test and code space of around 1k*/
steps = vStart - getInputVoltageX10(divisor, 0); steps = vStart - getInputVoltageX10(divisor, 0);
if (steps < 0) if (steps < 0) {
steps = -steps; steps = -steps;
}
if (steps > 4) { if (steps > 4) {
// No continuous mode, so QC2 // No continuous mode, so QC2
QCMode = QCState::QC_2; QCMode = QCState::QC_2;
@@ -104,8 +115,9 @@ void seekQC(int16_t Vx10, uint16_t divisor) {
QC_Seek9V(); QC_Seek9V();
} }
} }
#endif #endif /* ENABLE_QC2 */
} }
// Must be called after FreeRToS Starts // Must be called after FreeRToS Starts
void startQC(uint16_t divisor) { void startQC(uint16_t divisor) {
// Pre check that the input could be >5V already, and if so, dont both // Pre check that the input could be >5V already, and if so, dont both
@@ -143,7 +155,9 @@ void startQC(uint16_t divisor) {
} }
} }
} }
QC_DM_No_PullDown(); QC_DM_No_PullDown();
if (enteredQC) { if (enteredQC) {
// We have a QC capable charger // We have a QC capable charger
QC_Seek9V(); QC_Seek9V();
@@ -161,7 +175,6 @@ void startQC(uint16_t divisor) {
} }
QCMode = QCState::NOT_STARTED; QCMode = QCState::NOT_STARTED;
QCTries++; QCTries++;
} else { } else {
// no QC // no QC
QCTries++; QCTries++;

View File

@@ -261,8 +261,9 @@ uint16_t lookupHallEffectThreshold() {
uint8_t lookupVoltageLevel() { uint8_t lookupVoltageLevel() {
auto minVoltageOnCell = getSettingValue(SettingsOptions::MinDCVoltageCells); auto minVoltageOnCell = getSettingValue(SettingsOptions::MinDCVoltageCells);
auto minVoltageCellCount = getSettingValue(SettingsOptions::MinVoltageCells); auto minVoltageCellCount = getSettingValue(SettingsOptions::MinVoltageCells);
if (minVoltageOnCell == 0) if (minVoltageOnCell == 0) {
return 90; // 9V since iron does not function effectively below this return 90; // 9V since iron does not function effectively below this
else } else {
return (minVoltageOnCell * minVoltageCellCount) + (minVoltageCellCount * 2); return (minVoltageOnCell * minVoltageCellCount) + (minVoltageCellCount * 2);
}
} }

View File

@@ -175,7 +175,7 @@ static bool enterAdvancedMenu(void);
* Display Orientation * Display Orientation
* Cooldown Blink * Cooldown Blink
* Scrolling Speed * Scrolling Speed
* Swap Temp Change Buttons + - * Swap Temp Change Buttons +/-
* Animation Speed * Animation Speed
* -Animation Loop * -Animation Loop
* OLED Brightness * OLED Brightness
@@ -196,6 +196,14 @@ static bool enterAdvancedMenu(void);
* *
*/ */
/* vvv !!!DISABLE CLANG-FORMAT for menuitems initialization!!! vvv */
/* clang-format off */
/* A lot of suggestions by clang-format can be useful
* but not when dealing with such menuitems declarations.
*/
const menuitem rootSettingsMenu[] { const menuitem rootSettingsMenu[] {
/* /*
* Power Menu * Power Menu
@@ -207,21 +215,27 @@ const menuitem rootSettingsMenu[] {
* Exit * Exit
*/ */
#if defined(POW_DC) || defined(POW_QC) #if defined(POW_DC) || defined(POW_QC)
{0, enterPowerMenu, displayPowerMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Power*/ /* Power */
#endif /* POW_DC or POW_QC */ {0, enterPowerMenu, displayPowerMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
{0, enterSolderingMenu, displaySolderingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Soldering*/ #endif
{0, enterPowerSavingMenu, displayPowerSavingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Sleep Options Menu*/ /* Soldering */
{0, enterUIMenu, displayUIMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*UI Menu*/ {0, enterSolderingMenu, displaySolderingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
{0, enterAdvancedMenu, displayAdvancedMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Advanced Menu*/ /* Sleep Options Menu */
{0, settings_setLanguageSwitch, settings_displayLanguageSwitch, settings_showLanguageSwitch, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}, /*Language Switch*/ {0, enterPowerSavingMenu, displayPowerSavingMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
{ /* UI Menu */
0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0 {0, enterUIMenu, displayUIMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
} // end of menu marker. DO NOT REMOVE /* Advanced Menu */
{0, enterAdvancedMenu, displayAdvancedMenu, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
/* Language Switch */
{0, settings_setLanguageSwitch, settings_displayLanguageSwitch, settings_showLanguageSwitch, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0},
/* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
#if defined(POW_DC) || defined(POW_QC) || defined(POW_PD) #if defined(POW_DC) || defined(POW_QC) || defined(POW_PD)
const menuitem powerMenu[] = { const menuitem powerMenu[] = {
/* /*
* Power Source * Power Source
* -Minimum Voltage * -Minimum Voltage
* QC Voltage * QC Voltage
@@ -229,17 +243,24 @@ const menuitem powerMenu[] = {
* PDVpdo * PDVpdo
*/ */
#ifdef POW_DC #ifdef POW_DC
{SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells, SettingsItemIndex::DCInCutoff, 6}, /*Voltage input*/ /* Voltage input */
{SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, displayInputMinVRange, showInputVOptions, SettingsOptions::MinVoltageCells, SettingsItemIndex::MinVolCell, 5}, /*Minimum voltage input*/ {SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells, SettingsItemIndex::DCInCutoff, 6},
#endif /* POW_DC */ /* Minimum voltage input */
{SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, displayInputMinVRange, showInputVOptions, SettingsOptions::MinVoltageCells, SettingsItemIndex::MinVolCell, 5},
#endif
#ifdef POW_QC #ifdef POW_QC
{SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage, SettingsItemIndex::QCMaxVoltage, 4}, /*Voltage input*/ /* Voltage input */
#endif /* POW_QC */ {SETTINGS_DESC(SettingsItemIndex::QCMaxVoltage), nullptr, displayQCInputV, nullptr, SettingsOptions::QCIdealVoltage, SettingsItemIndex::QCMaxVoltage, 4},
#endif
#ifdef POW_PD #ifdef POW_PD
{SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout, SettingsItemIndex::PDNegTimeout, 5}, /*PD timeout setup*/ /* PD timeout setup */
{SETTINGS_DESC(SettingsItemIndex::PDVpdo), nullptr, displayPDVpdo, nullptr, SettingsOptions::PDVpdo, SettingsItemIndex::PDVpdo, 7 }, /*Toggle PPS & EPR*/ {SETTINGS_DESC(SettingsItemIndex::PDNegTimeout), nullptr, displayPDNegTimeout, nullptr, SettingsOptions::PDNegTimeout, SettingsItemIndex::PDNegTimeout, 5},
#endif /* POW_PD */ /* Toggle PPS & EPR */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE {SETTINGS_DESC(SettingsItemIndex::PDVpdo), nullptr, displayPDVpdo, nullptr, SettingsOptions::PDVpdo, SettingsItemIndex::PDVpdo, 7},
#endif
/* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
#endif /* POW_DC or POW_QC or POW_PD */ #endif /* POW_DC or POW_QC or POW_PD */
@@ -265,30 +286,49 @@ const menuitem solderingMenu[] = {
* Profile Phase 5 Duration (s) * Profile Phase 5 Duration (s)
* Profile Cooldown Max Temperature Change Per Second * Profile Cooldown Max Temperature Change Per Second
*/ */
{SETTINGS_DESC(SettingsItemIndex::BoostTemperature), setBoostTemp, displayBoostTemp, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::BoostTemperature, 5}, /*Boost Temp*/ /* Boost Temp */
{SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, displayAutomaticStartMode, nullptr, SettingsOptions::AutoStartMode, SettingsItemIndex::AutoStart, 7}, /*Auto start*/ {SETTINGS_DESC(SettingsItemIndex::BoostTemperature), setBoostTemp, displayBoostTemp, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::BoostTemperature, 5},
{SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, displayTempChangeShortStep, nullptr, SettingsOptions::TempChangeShortStep, SettingsItemIndex::TempChangeShortStep, /* Auto start */
6}, /*Temp change short step*/ {SETTINGS_DESC(SettingsItemIndex::AutoStart), nullptr, displayAutomaticStartMode, nullptr, SettingsOptions::AutoStartMode, SettingsItemIndex::AutoStart, 7},
{SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep, SettingsItemIndex::TempChangeLongStep, /* Temp change short step */
6}, /*Temp change long step*/ {SETTINGS_DESC(SettingsItemIndex::TempChangeShortStep), nullptr, displayTempChangeShortStep, nullptr, SettingsOptions::TempChangeShortStep, SettingsItemIndex::TempChangeShortStep, 6},
{SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, displayLockingMode, nullptr, SettingsOptions::LockingMode, SettingsItemIndex::LockingMode, 7}, /*Locking Mode*/ /* Temp change long step */
{SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep, SettingsItemIndex::TempChangeLongStep, 6},
/* Locking Mode */
{SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, displayLockingMode, nullptr, SettingsOptions::LockingMode, SettingsItemIndex::LockingMode, 7},
#ifdef PROFILE_SUPPORT #ifdef PROFILE_SUPPORT
{SETTINGS_DESC(SettingsItemIndex::ProfilePhases), nullptr, displayProfilePhases, nullptr, SettingsOptions::ProfilePhases, SettingsItemIndex::ProfilePhases, 7}, /*Profile Phases*/ /* Profile Phases */
{SETTINGS_DESC(SettingsItemIndex::ProfilePreheatTemp), setProfilePreheatTemp, displayProfilePreheatTemp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePreheatTemp, 5}, /*Profile Preheat Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePhases), nullptr, displayProfilePhases, nullptr, SettingsOptions::ProfilePhases, SettingsItemIndex::ProfilePhases, 7},
{SETTINGS_DESC(SettingsItemIndex::ProfilePreheatSpeed), nullptr, displayProfilePreheatSpeed, showProfileOptions, SettingsOptions::ProfilePreheatSpeed, SettingsItemIndex::ProfilePreheatSpeed, 5}, /*Profile Preheat Speed*/ /* Profile Preheat Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase1Temp, displayProfilePhase1Temp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase1Temp, 5}, /*Phase 1 Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatTemp), setProfilePreheatTemp, displayProfilePreheatTemp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePreheatTemp, 5},
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase1Duration, showProfileOptions, SettingsOptions::ProfilePhase1Duration, SettingsItemIndex::ProfilePhase1Duration, 5}, /*Phase 1 Duration*/ /* Profile Preheat Speed */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase2Temp, displayProfilePhase2Temp, showProfilePhase2Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase2Temp, 5}, /*Phase 2 Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePreheatSpeed), nullptr, displayProfilePreheatSpeed, showProfileOptions, SettingsOptions::ProfilePreheatSpeed, SettingsItemIndex::ProfilePreheatSpeed, 5},
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase2Duration, showProfilePhase2Options, SettingsOptions::ProfilePhase2Duration, SettingsItemIndex::ProfilePhase2Duration, 5}, /*Phase 2 Duration*/ /* Phase 1 Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase3Temp, displayProfilePhase3Temp, showProfilePhase3Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase3Temp, 5}, /*Phase 3 Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase1Temp, displayProfilePhase1Temp, showProfileOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase1Temp, 5},
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase3Duration, showProfilePhase3Options, SettingsOptions::ProfilePhase3Duration, SettingsItemIndex::ProfilePhase3Duration, 5}, /*Phase 3 Duration*/ /* Phase 1 Duration */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase4Temp, displayProfilePhase4Temp, showProfilePhase4Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase4Temp, 5}, /*Phase 4 Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase1Duration, showProfileOptions, SettingsOptions::ProfilePhase1Duration, SettingsItemIndex::ProfilePhase1Duration, 5},
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase4Duration, showProfilePhase4Options, SettingsOptions::ProfilePhase4Duration, SettingsItemIndex::ProfilePhase4Duration, 5}, /*Phase 4 Duration*/ /* Phase 2 Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase5Temp, displayProfilePhase5Temp, showProfilePhase5Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase5Temp, 5}, /*Phase 5 Temp*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase2Temp, displayProfilePhase2Temp, showProfilePhase2Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase2Temp, 5},
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase5Duration, showProfilePhase5Options, SettingsOptions::ProfilePhase5Duration, SettingsItemIndex::ProfilePhase5Duration, 5}, /*Phase 5 Duration*/ /* Phase 2 Duration */
{SETTINGS_DESC(SettingsItemIndex::ProfileCooldownSpeed), nullptr, displayProfileCooldownSpeed, showProfileOptions, SettingsOptions::ProfileCooldownSpeed, SettingsItemIndex::ProfileCooldownSpeed, 5}, /*Profile Cooldown Speed*/ {SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase2Duration, showProfilePhase2Options, SettingsOptions::ProfilePhase2Duration, SettingsItemIndex::ProfilePhase2Duration, 5},
/* Phase 3 Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase3Temp, displayProfilePhase3Temp, showProfilePhase3Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase3Temp, 5},
/* Phase 3 Duration */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase3Duration, showProfilePhase3Options, SettingsOptions::ProfilePhase3Duration, SettingsItemIndex::ProfilePhase3Duration, 5},
/* Phase 4 Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase4Temp, displayProfilePhase4Temp, showProfilePhase4Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase4Temp, 5},
/* Phase 4 Duration */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase4Duration, showProfilePhase4Options, SettingsOptions::ProfilePhase4Duration, SettingsItemIndex::ProfilePhase4Duration, 5},
/* Phase 5 Temp */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase5Temp, displayProfilePhase5Temp, showProfilePhase5Options, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::ProfilePhase5Temp, 5},
/* Phase 5 Duration */
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase5Duration, showProfilePhase5Options, SettingsOptions::ProfilePhase5Duration, SettingsItemIndex::ProfilePhase5Duration, 5},
/* Profile Cooldown Speed */
{SETTINGS_DESC(SettingsItemIndex::ProfileCooldownSpeed), nullptr, displayProfileCooldownSpeed, showProfileOptions, SettingsOptions::ProfileCooldownSpeed, SettingsItemIndex::ProfileCooldownSpeed, 5},
#endif /* PROFILE_SUPPORT */ #endif /* PROFILE_SUPPORT */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE /* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
const menuitem PowerSavingMenu[] = { const menuitem PowerSavingMenu[] = {
@@ -299,18 +339,23 @@ const menuitem PowerSavingMenu[] = {
* -Shutdown Time * -Shutdown Time
* Hall Sensor Sensitivity * Hall Sensor Sensitivity
*/ */
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, displaySensitivity, nullptr, SettingsOptions::Sensitivity, SettingsItemIndex::MotionSensitivity, 7}, /* Motion Sensitivity*/ /* Motion Sensitivity */
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, displaySensitivity, nullptr, SettingsOptions::Sensitivity, SettingsItemIndex::MotionSensitivity, 7},
#ifndef NO_SLEEP_MODE #ifndef NO_SLEEP_MODE
{SETTINGS_DESC(SettingsItemIndex::SleepTemperature), setSleepTemp, displaySleepTemp, showSleepOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SleepTemperature, /* Sleep Temp */
5}, /*Sleep Temp*/ {SETTINGS_DESC(SettingsItemIndex::SleepTemperature), setSleepTemp, displaySleepTemp, showSleepOptions, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SleepTemperature, 5},
{SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, displaySleepTime, showSleepOptions, SettingsOptions::SleepTime, SettingsItemIndex::SleepTimeout, 5}, /*Sleep Time*/ /* Sleep Time */
{SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, displaySleepTime, showSleepOptions, SettingsOptions::SleepTime, SettingsItemIndex::SleepTimeout, 5},
#endif /* *not* NO_SLEEP_MODE */ #endif /* *not* NO_SLEEP_MODE */
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, displayShutdownTime, showSleepOptions, SettingsOptions::ShutdownTime, SettingsItemIndex::ShutdownTimeout, 5}, /*Shutdown Time*/ /* Shutdown Time */
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, displayShutdownTime, showSleepOptions, SettingsOptions::ShutdownTime, SettingsItemIndex::ShutdownTimeout, 5},
#ifdef HALL_SENSOR #ifdef HALL_SENSOR
{SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, displayHallEffect, showHallEffect, SettingsOptions::HallEffectSensitivity, SettingsItemIndex::HallEffSensitivity, /* Hall Effect Sensitivity */
7}, /* HallEffect Sensitivity*/ {SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, displayHallEffect, showHallEffect, SettingsOptions::HallEffectSensitivity, SettingsItemIndex::HallEffSensitivity, 7},
#endif /* HALL_SENSOR */ #endif /* HALL_SENSOR */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE /* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
const menuitem UIMenu[] = { const menuitem UIMenu[] = {
@@ -319,7 +364,7 @@ const menuitem UIMenu[] = {
* Display Orientation * Display Orientation
* Cooldown Blink * Cooldown Blink
* Scrolling Speed * Scrolling Speed
* Swap Temp Change Buttons + - * Swap Temp Change Buttons +/-
* Animation Speed * Animation Speed
* -Animation Loop * -Animation Loop
* OLED Brightness * OLED Brightness
@@ -328,30 +373,39 @@ const menuitem UIMenu[] = {
* Detailed IDLE * Detailed IDLE
* Detailed Soldering * Detailed Soldering
*/ */
{SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), setTempF, displayTempF, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::TemperatureUnit, /* Temperature units, this has to be the first element in the array to work with the logic in enterUIMenu() */
7}, /* Temperature units, this has to be the first element in the array to work with the logic in enterUIMenu() */ {SETTINGS_DESC(SettingsItemIndex::TemperatureUnit), setTempF, displayTempF, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::TemperatureUnit, 7},
#ifndef NO_DISPLAY_ROTATE #ifndef NO_DISPLAY_ROTATE
{SETTINGS_DESC(SettingsItemIndex::DisplayRotation), setDisplayRotation, displayDisplayRotation, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::DisplayRotation, /* Display Rotation */
7}, /*Display Rotation*/ {SETTINGS_DESC(SettingsItemIndex::DisplayRotation), setDisplayRotation, displayDisplayRotation, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::DisplayRotation, 7},
#endif /* *not* NO_DISPLAY_ROTATE */ #endif /* *not* NO_DISPLAY_ROTATE */
{SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, displayCoolingBlinkEnabled, nullptr, SettingsOptions::CoolingTempBlink, SettingsItemIndex::CooldownBlink, 7}, /*Cooling blink warning*/ /* Cooling blink warning */
{SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, displayScrollSpeed, nullptr, SettingsOptions::DescriptionScrollSpeed, SettingsItemIndex::ScrollingSpeed, {SETTINGS_DESC(SettingsItemIndex::CooldownBlink), nullptr, displayCoolingBlinkEnabled, nullptr, SettingsOptions::CoolingTempBlink, SettingsItemIndex::CooldownBlink, 7},
7}, /*Scroll Speed for descriptions*/ /* Scroll Speed for descriptions */
{SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled, {SETTINGS_DESC(SettingsItemIndex::ScrollingSpeed), nullptr, displayScrollSpeed, nullptr, SettingsOptions::DescriptionScrollSpeed, SettingsItemIndex::ScrollingSpeed, 7},
SettingsItemIndex::ReverseButtonTempChange, 7}, /*Reverse Temp change buttons + - */ /* Reverse Temp change buttons +/- */
{SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7}, /*Animation Speed adjustment */ {SETTINGS_DESC(SettingsItemIndex::ReverseButtonTempChange), nullptr, displayReverseButtonTempChangeEnabled, nullptr, SettingsOptions::ReverseButtonTempChangeEnabled, SettingsItemIndex::ReverseButtonTempChange, 7},
{SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, displayAnimationLoop, displayAnimationOptions, SettingsOptions::AnimationLoop, SettingsItemIndex::AnimLoop, 7}, /*Animation Loop switch */ /* Animation Speed adjustment */
{SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness, SettingsItemIndex::Brightness, 7}, /*Brightness Level*/ {SETTINGS_DESC(SettingsItemIndex::AnimSpeed), nullptr, displayAnimationSpeed, nullptr, SettingsOptions::AnimationSpeed, SettingsItemIndex::AnimSpeed, 7},
{SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, displayInvertColor, nullptr, SettingsOptions::OLEDInversion, SettingsItemIndex::ColourInversion, 7}, /*Invert screen colour*/ /* Animation Loop switch */
{SETTINGS_DESC(SettingsItemIndex::LOGOTime), nullptr, displayLogoTime, nullptr, SettingsOptions::LOGOTime, SettingsItemIndex::LOGOTime, 5}, /*Set logo duration*/ {SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, displayAnimationLoop, displayAnimationOptions, SettingsOptions::AnimationLoop, SettingsItemIndex::AnimLoop, 7},
{SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE, SettingsItemIndex::AdvancedIdle, 7}, /*Advanced idle screen*/ /* Brightness Level */
{SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering, SettingsItemIndex::AdvancedSoldering, {SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness, SettingsItemIndex::Brightness, 7},
7}, /*Advanced soldering screen*/ /* Invert screen colour */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE {SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, displayInvertColor, nullptr, SettingsOptions::OLEDInversion, SettingsItemIndex::ColourInversion, 7},
/* Set logo duration */
{SETTINGS_DESC(SettingsItemIndex::LOGOTime), nullptr, displayLogoTime, nullptr, SettingsOptions::LOGOTime, SettingsItemIndex::LOGOTime, 5},
/* Advanced idle screen */
{SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE, SettingsItemIndex::AdvancedIdle, 7},
/* Advanced soldering screen */
{SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering, SettingsItemIndex::AdvancedSoldering, 7},
/* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
const menuitem advancedMenu[] = { const menuitem advancedMenu[] = {
/* /*
* BluetoothLE * BluetoothLE
* Power Limit * Power Limit
* Calibrate CJC At Next Boot * Calibrate CJC At Next Boot
@@ -362,22 +416,32 @@ const menuitem advancedMenu[] = {
* Factory Reset * Factory Reset
*/ */
#ifdef BLE_ENABLED #ifdef BLE_ENABLED
{SETTINGS_DESC(SettingsItemIndex::BluetoothLE), nullptr, displayBluetoothLE, nullptr, SettingsOptions::BluetoothLE, SettingsItemIndex::BluetoothLE, 7}, /*Toggle BLE*/ /* Toggle BLE */
{SETTINGS_DESC(SettingsItemIndex::BluetoothLE), nullptr, displayBluetoothLE, nullptr, SettingsOptions::BluetoothLE, SettingsItemIndex::BluetoothLE, 7},
#endif /* BLE_ENABLED */ #endif /* BLE_ENABLED */
{SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 4}, /*Power limit*/ /* Power limit */
{SETTINGS_DESC(SettingsItemIndex::CalibrateCJC), setCalibrate, displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::CalibrateCJC, {SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 4},
7}, /*Calibrate Cold Junktion Compensation at next boot*/ /* Calibrate Cold Junktion Compensation at next boot */
{SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), setCalibrateVIN, displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::VoltageCalibration, {SETTINGS_DESC(SettingsItemIndex::CalibrateCJC), setCalibrate, displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::CalibrateCJC, 7},
5}, /*Voltage input cal*/ /* Voltage input cal */
{SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, displayPowerPulse, nullptr, SettingsOptions::KeepAwakePulse, SettingsItemIndex::PowerPulsePower, 5}, /*Power Pulse adjustment */ {SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), setCalibrateVIN, displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::VoltageCalibration, 5},
{SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, displayPowerPulseWait, showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait, SettingsItemIndex::PowerPulseWait, /* Power Pulse adjustment */
7}, /*Power Pulse Wait adjustment*/ {SETTINGS_DESC(SettingsItemIndex::PowerPulsePower), nullptr, displayPowerPulse, nullptr, SettingsOptions::KeepAwakePulse, SettingsItemIndex::PowerPulsePower, 5},
{SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, displayPowerPulseDuration, showPowerPulseOptions, SettingsOptions::KeepAwakePulseDuration, SettingsItemIndex::PowerPulseDuration, /* Power Pulse Wait adjustment */
7}, /*Power Pulse Duration adjustment*/ {SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, displayPowerPulseWait, showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait, SettingsItemIndex::PowerPulseWait, 7},
{SETTINGS_DESC(SettingsItemIndex::SettingsReset), setResetSettings, displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SettingsReset, 7}, /*Resets settings*/ /* Power Pulse Duration adjustment */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE {SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, displayPowerPulseDuration, showPowerPulseOptions, SettingsOptions::KeepAwakePulseDuration, SettingsItemIndex::PowerPulseDuration, 7},
/* Resets settings */
{SETTINGS_DESC(SettingsItemIndex::SettingsReset), setResetSettings, displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SettingsReset, 7},
/* vvvv end of menu marker. DO NOT REMOVE vvvv */
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
/* ^^^^ end of menu marker. DO NOT REMOVE ^^^^ */
}; };
/* clang-format on */
/* ^^^ !!!ENABLE CLANG-FORMAT back!!! ^^^ */
/** /**
* Prints two small lines (or one line for CJK) of short description for * Prints two small lines (or one line for CJK) of short description for
* setting items and prepares cursor after it. * setting items and prepares cursor after it.
@@ -552,23 +616,23 @@ static void displayLockingMode(void) {
#ifdef PROFILE_SUPPORT #ifdef PROFILE_SUPPORT
static void displayProfilePhases(void) { static void displayProfilePhases(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhases), 1, FontStyle::LARGE); }
OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhases), 1, FontStyle::LARGE);
}
static bool setProfileTemp(const enum SettingsOptions option) { static bool setProfileTemp(const enum SettingsOptions option) {
// If in C, 5 deg, if in F 10 deg // If in C, 5 deg, if in F 10 deg
uint16_t temp = getSettingValue(option); uint16_t temp = getSettingValue(option);
if (getSettingValue(SettingsOptions::TemperatureInF)) { if (getSettingValue(SettingsOptions::TemperatureInF)) {
temp += 10; temp += 10;
if (temp > MAX_TEMP_F) if (temp > MAX_TEMP_F) {
temp = MIN_TEMP_F; temp = MIN_TEMP_F;
}
setSettingValue(option, temp); setSettingValue(option, temp);
return temp == MAX_TEMP_F; return temp == MAX_TEMP_F;
} else { } else {
temp += 5; temp += 5;
if (temp > MAX_TEMP_C) if (temp > MAX_TEMP_C) {
temp = MIN_TEMP_C; temp = MIN_TEMP_C;
}
setSettingValue(option, temp); setSettingValue(option, temp);
return temp == MAX_TEMP_C; return temp == MAX_TEMP_C;
} }
@@ -613,14 +677,16 @@ static bool setSleepTemp(void) {
uint16_t temp = getSettingValue(SettingsOptions::SleepTemp); uint16_t temp = getSettingValue(SettingsOptions::SleepTemp);
if (getSettingValue(SettingsOptions::TemperatureInF)) { if (getSettingValue(SettingsOptions::TemperatureInF)) {
temp += 20; temp += 20;
if (temp > 580) if (temp > 580) {
temp = 60; temp = 60;
}
setSettingValue(SettingsOptions::SleepTemp, temp); setSettingValue(SettingsOptions::SleepTemp, temp);
return temp == 580; return temp == 580;
} else { } else {
temp += 10; temp += 10;
if (temp > 300) if (temp > 300) {
temp = 10; temp = 10;
}
setSettingValue(SettingsOptions::SleepTemp, temp); setSettingValue(SettingsOptions::SleepTemp, temp);
return temp == 300; return temp == 300;
} }
@@ -691,7 +757,7 @@ static bool setTempF(void) {
return res; return res;
} }
static void displayTempF(void) { OLED::print((getSettingValue(SettingsOptions::TemperatureInF)) ? LargeSymbolDegF : LargeSymbolDegC, FontStyle::LARGE); } static void displayTempF(void) { OLED::printSymbolDeg(FontStyle::LARGE); }
#ifndef NO_DISPLAY_ROTATE #ifndef NO_DISPLAY_ROTATE
@@ -1057,10 +1123,12 @@ void gui_Menu(const menuitem *menu) {
menu[currentScreen].draw(); menu[currentScreen].draw();
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize; uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
uint8_t position = OLED_HEIGHT * (currentScreen - screensSkipped) / scrollContentSize; uint8_t position = OLED_HEIGHT * (currentScreen - screensSkipped) / scrollContentSize;
if (lastValue) if (lastValue) {
scrollBlink = !scrollBlink; scrollBlink = !scrollBlink;
if (!lastValue || !scrollBlink) }
if (!lastValue || !scrollBlink) {
OLED::drawScrollIndicator(position, indicatorHeight); OLED::drawScrollIndicator(position, indicatorHeight);
}
} else { } else {
// Draw description // Draw description
const char *description = translatedString(Tr->SettingsDescriptions[menu[currentScreen].description - 1]); const char *description = translatedString(Tr->SettingsDescriptions[menu[currentScreen].description - 1]);
@@ -1107,29 +1175,28 @@ void gui_Menu(const menuitem *menu) {
// increment // increment
if (scrollMessage.isReset()) { if (scrollMessage.isReset()) {
lastValue = callIncrementHandler(); lastValue = callIncrementHandler();
} else } else {
scrollMessage.reset(); scrollMessage.reset();
}
break; break;
case BUTTON_B_SHORT: case BUTTON_B_SHORT:
if (scrollMessage.isReset()) { if (scrollMessage.isReset()) {
currentScreen++; currentScreen++;
navState = NavState::ScrollingDown; navState = NavState::ScrollingDown;
lastValue = false; lastValue = false;
} else } else {
scrollMessage.reset(); scrollMessage.reset();
}
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
if (xTaskGetTickCount() + autoRepeatAcceleration > autoRepeatTimer + PRESS_ACCEL_INTERVAL_MAX) { if (xTaskGetTickCount() + autoRepeatAcceleration > autoRepeatTimer + PRESS_ACCEL_INTERVAL_MAX) {
if ((lastValue = callIncrementHandler())) {
if ((lastValue = callIncrementHandler()))
autoRepeatTimer = 1000; autoRepeatTimer = 1000;
else } else {
autoRepeatTimer = 0; autoRepeatTimer = 0;
}
autoRepeatTimer += xTaskGetTickCount(); autoRepeatTimer += xTaskGetTickCount();
scrollMessage.reset(); scrollMessage.reset();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
} }
break; break;
@@ -1139,7 +1206,6 @@ void gui_Menu(const menuitem *menu) {
navState = NavState::ScrollingDown; navState = NavState::ScrollingDown;
autoRepeatTimer = xTaskGetTickCount(); autoRepeatTimer = xTaskGetTickCount();
scrollMessage.reset(); scrollMessage.reset();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
} }
break; break;

View File

@@ -20,8 +20,9 @@ void performCJCC(void) {
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL); OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
OLED::print(SmallSymbolDot, FontStyle::SMALL); OLED::print(SmallSymbolDot, FontStyle::SMALL);
for (uint8_t x = 0; x < (i / 4); x++) for (uint8_t x = 0; x < (i / 4); x++) {
OLED::print(SmallSymbolDot, FontStyle::SMALL); OLED::print(SmallSymbolDot, FontStyle::SMALL);
}
OLED::refresh(); OLED::refresh();
osDelay(100); osDelay(100);
} }

View File

@@ -57,8 +57,8 @@ void showDebugMenu(void) {
case 9: // Movement Timestamp case 9: // Movement Timestamp
OLED::printNumber(lastMovementTime / TICKS_100MS, 8, FontStyle::SMALL); OLED::printNumber(lastMovementTime / TICKS_100MS, 8, FontStyle::SMALL);
break; break;
case 10: // Tip Resistance in Ω case 10: // Tip Resistance in Ω large to pad over so that we cover ID left overs
OLED::printNumber(getTipResistanceX10() / 10, 6, FontStyle::SMALL); // large to pad over so that we cover ID left overs OLED::printNumber(getTipResistanceX10() / 10, 6, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL); OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL); OLED::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL);
break; break;
@@ -82,8 +82,9 @@ void showDebugMenu(void) {
case 16: // Raw Hall Effect Value case 16: // Raw Hall Effect Value
{ {
int16_t hallEffectStrength = getRawHallEffect(); int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0) if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength; hallEffectStrength = -hallEffectStrength;
}
OLED::printNumber(hallEffectStrength, 6, FontStyle::SMALL); OLED::printNumber(hallEffectStrength, 6, FontStyle::SMALL);
} break; } break;
#endif #endif
@@ -94,9 +95,9 @@ void showDebugMenu(void) {
OLED::refresh(); OLED::refresh();
b = getButtonState(); b = getButtonState();
if (b == BUTTON_B_SHORT) if (b == BUTTON_B_SHORT) {
return; return;
else if (b == BUTTON_F_SHORT) { } else if (b == BUTTON_F_SHORT) {
screen++; screen++;
#ifdef HALL_SENSOR #ifdef HALL_SENSOR
screen = screen % 17; screen = screen % 17;
@@ -104,6 +105,7 @@ void showDebugMenu(void) {
screen = screen % 16; screen = screen % 16;
#endif #endif
} }
GUIDelay(); GUIDelay();
} }
} }

View File

@@ -49,8 +49,15 @@ void handleButtons(bool *buttonLockout) {
showDebugMenu(); showDebugMenu();
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
#ifdef PROFILE_SUPPORT
if (!isTipDisconnected()) {
gui_solderingProfileMode(); // enter profile mode
*buttonLockout = true;
}
#else
gui_solderingTempAdjust(); gui_solderingTempAdjust();
saveSettings(); saveSettings();
#endif
break; break;
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
if (!isTipDisconnected()) { if (!isTipDisconnected()) {
@@ -96,21 +103,22 @@ void drawDetailedHomeScreen(uint32_t tipTemp) {
} }
OLED::print(SmallSymbolVolts, FontStyle::SMALL); OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else { } else {
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300))) if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300))) {
// Blink temp if setting enable and temp < 55° // Blink temp if setting enable and temp < 55°
// 1000 tick/sec // 1000 tick/sec
// OFF 300ms ON 700ms // OFF 300ms ON 700ms
gui_drawTipTemp(true, FontStyle::LARGE); // draw in the temp gui_drawTipTemp(true, FontStyle::LARGE); // draw in the temp
}
if (OLED::getRotation()) { if (OLED::getRotation()) {
OLED::setCursor(6, 0); OLED::setCursor(6, 0);
} else { } else {
OLED::setCursor(73, 0); // top right OLED::setCursor(73, 0); // top right
} }
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL); // draw set temp // draw set temp
if (getSettingValue(SettingsOptions::TemperatureInF)) OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL);
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else OLED::printSymbolDeg(FontStyle::SMALL);
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
if (OLED::getRotation()) { if (OLED::getRotation()) {
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
} else { } else {
@@ -135,10 +143,11 @@ void drawSimplifiedHomeScreen(uint32_t tipTemp) {
gui_drawBatteryIcon(); gui_drawBatteryIcon();
} }
tipDisconnectedDisplay = false; tipDisconnectedDisplay = false;
if (tipTemp > 55) if (tipTemp > 55) {
tempOnDisplay = true; tempOnDisplay = true;
else if (tipTemp < 45) } else if (tipTemp < 45) {
tempOnDisplay = false; tempOnDisplay = false;
}
if (isTipDisconnected()) { if (isTipDisconnected()) {
tempOnDisplay = false; tempOnDisplay = false;
tipDisconnectedDisplay = true; tipDisconnectedDisplay = true;
@@ -157,8 +166,9 @@ void drawSimplifiedHomeScreen(uint32_t tipTemp) {
// If we have a tip connected draw the temp, if not we leave it blank // If we have a tip connected draw the temp, if not we leave it blank
if (!tipDisconnectedDisplay) { if (!tipDisconnectedDisplay) {
// draw in the temp // draw in the temp
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp
}
} else { } else {
// Draw in missing tip symbol // Draw in missing tip symbol

View File

@@ -47,4 +47,5 @@ void renderHomeScreenAssets(void); // Called to
// Common helpers // Common helpers
int8_t getPowerSourceNumber(void); // Returns number ID of power source int8_t getPowerSourceNumber(void); // Returns number ID of power source
uint16_t getTipTemp(void); // Returns temperature of the tip in *C/*F (based on user settings)
#endif #endif

View File

@@ -12,16 +12,20 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
// If in the first two seconds we disable this to let accelerometer warm up // If in the first two seconds we disable this to let accelerometer warm up
#ifdef POW_DC #ifdef POW_DC
if (checkForUnderVoltage()) if (checkForUnderVoltage()) {
return 1; // return non-zero on error // return non-zero on error
return 1;
}
#endif #endif
if (getSettingValue(SettingsOptions::TemperatureInF)) { if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp))); currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp)));
} else { } else {
currentTempTargetDegC = stayOff ? 0 : min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp)); currentTempTargetDegC = stayOff ? 0 : min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp));
} }
// draw the lcd // draw the lcd
uint16_t tipTemp = getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC(); uint16_t tipTemp = getTipTemp();
OLED::clearScreen(); OLED::clearScreen();
OLED::setCursor(0, 0); OLED::setCursor(0, 0);
@@ -30,23 +34,14 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL); OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL); OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
if (getSettingValue(SettingsOptions::TemperatureInF)) OLED::printSymbolDeg(FontStyle::SMALL);
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
OLED::print(SmallSymbolSpace, FontStyle::SMALL); OLED::print(SmallSymbolSpace, FontStyle::SMALL);
printVoltage(); printVoltage();
OLED::print(SmallSymbolVolts, FontStyle::SMALL); OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else { } else {
OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE); OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE); OLED::printNumber(tipTemp, 3, FontStyle::LARGE);
if (getSettingValue(SettingsOptions::TemperatureInF)) OLED::printSymbolDeg(FontStyle::EXTRAS);
OLED::drawSymbol(0);
else {
OLED::drawSymbol(1);
}
} }
OLED::refresh(); OLED::refresh();
@@ -59,9 +54,11 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
if (shouldShutdown()) { if (shouldShutdown()) {
// shutdown // shutdown
currentTempTargetDegC = 0; currentTempTargetDegC = 0;
return 1; // we want to exit soldering mode // we want to exit soldering mode
return 1;
} }
} }
#endif #endif
return 0; return 0;
} }

View File

@@ -147,15 +147,15 @@ void gui_solderingMode(uint8_t jumpToSleep) {
OLED::refresh(); OLED::refresh();
// Update the setpoints for the temperature // Update the setpoints for the temperature
if (boostModeOn) { if (boostModeOn) {
if (getSettingValue(SettingsOptions::TemperatureInF)) if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::BoostTemp)); currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::BoostTemp));
else { } else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::BoostTemp)); currentTempTargetDegC = (getSettingValue(SettingsOptions::BoostTemp));
} }
} else { } else {
if (getSettingValue(SettingsOptions::TemperatureInF)) if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::SolderingTemp)); currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::SolderingTemp));
else { } else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::SolderingTemp)); currentTempTargetDegC = (getSettingValue(SettingsOptions::SolderingTemp));
} }
} }
@@ -187,4 +187,3 @@ void gui_solderingMode(uint8_t jumpToSleep) {
GUIDelay(); GUIDelay();
} }
} }

View File

@@ -32,7 +32,9 @@ void gui_solderingProfileMode() {
for (;;) { for (;;) {
ButtonState buttons = getButtonState(); ButtonState buttons = getButtonState();
if (buttons) { if (buttons) {
if (waitForRelease) buttons = BUTTON_NONE; if (waitForRelease) {
buttons = BUTTON_NONE;
}
} else { } else {
waitForRelease = false; waitForRelease = false;
} }
@@ -52,11 +54,7 @@ void gui_solderingProfileMode() {
break; break;
} }
if (getSettingValue(SettingsOptions::TemperatureInF)) { tipTemp = getTipTemp();
tipTemp = TipThermoModel::getTipInF();
} else {
tipTemp = TipThermoModel::getTipInC();
}
// if start temp is unknown (preheat), we're setting it now // if start temp is unknown (preheat), we're setting it now
if (phaseStartTemp == 0) { if (phaseStartTemp == 0) {
@@ -73,9 +71,11 @@ void gui_solderingProfileMode() {
// have we finished this phase? // have we finished this phase?
if (phaseElapsedSeconds >= phaseTotalSeconds && tipTemp == phaseEndTemp) { if (phaseElapsedSeconds >= phaseTotalSeconds && tipTemp == phaseEndTemp) {
profilePhase++; profilePhase++;
phaseStartTemp = phaseEndTemp; phaseStartTemp = phaseEndTemp;
phaseStartTime = xTaskGetTickCount(); phaseStartTime = xTaskGetTickCount();
phaseElapsedSeconds = 0; phaseElapsedSeconds = 0;
if (profilePhase > getSettingValue(SettingsOptions::ProfilePhases)) { if (profilePhase > getSettingValue(SettingsOptions::ProfilePhases)) {
// done with all phases, lets go to cooldown // done with all phases, lets go to cooldown
phaseTotalSeconds = 0; phaseTotalSeconds = 0;
@@ -83,7 +83,7 @@ void gui_solderingProfileMode() {
phaseTicksPerDegree = TICKS_SECOND / getSettingValue(SettingsOptions::ProfileCooldownSpeed); phaseTicksPerDegree = TICKS_SECOND / getSettingValue(SettingsOptions::ProfileCooldownSpeed);
} else { } else {
// set up next phase // set up next phase
switch(profilePhase) { switch (profilePhase) {
case 1: case 1:
phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase1Duration); phaseTotalSeconds = getSettingValue(SettingsOptions::ProfilePhase1Duration);
phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase1Temp); phaseEndTemp = getSettingValue(SettingsOptions::ProfilePhase1Temp);
@@ -151,11 +151,7 @@ void gui_solderingProfileMode() {
OLED::printNumber(tipTemp, 3, FontStyle::SMALL); OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
OLED::print(SmallSymbolSlash, FontStyle::SMALL); OLED::print(SmallSymbolSlash, FontStyle::SMALL);
OLED::printNumber(profileCurrentTargetTemp, 3, FontStyle::SMALL); OLED::printNumber(profileCurrentTargetTemp, 3, FontStyle::SMALL);
OLED::printSymbolDeg(FontStyle::SMALL);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
// print phase // print phase
if (profilePhase > 0 && profilePhase <= getSettingValue(SettingsOptions::ProfilePhases)) { if (profilePhase > 0 && profilePhase <= getSettingValue(SettingsOptions::ProfilePhases)) {
@@ -186,7 +182,7 @@ void gui_solderingProfileMode() {
OLED::print(SmallSymbolSlash, FontStyle::SMALL); OLED::print(SmallSymbolSlash, FontStyle::SMALL);
// blink if we can't keep up with the time goal // blink if we can't keep up with the time goal
if (phaseElapsedSeconds < phaseTotalSeconds+2 || (xTaskGetTickCount() / TICKS_SECOND) % 2 == 0) { if (phaseElapsedSeconds < phaseTotalSeconds + 2 || (xTaskGetTickCount() / TICKS_SECOND) % 2 == 0) {
OLED::printNumber(phaseTotalSeconds / 60, 1, FontStyle::SMALL); OLED::printNumber(phaseTotalSeconds / 60, 1, FontStyle::SMALL);
OLED::print(SmallSymbolColon, FontStyle::SMALL); OLED::print(SmallSymbolColon, FontStyle::SMALL);
OLED::printNumber(phaseTotalSeconds % 60, 2, FontStyle::SMALL, false); OLED::printNumber(phaseTotalSeconds % 60, 2, FontStyle::SMALL, false);
@@ -225,4 +221,3 @@ void gui_solderingProfileMode() {
GUIDelay(); GUIDelay();
} }
} }

View File

@@ -79,20 +79,25 @@ void gui_solderingTempAdjust(void) {
newTemp = (newTemp / delta) * delta; newTemp = (newTemp / delta) * delta;
if (getSettingValue(SettingsOptions::TemperatureInF)) { if (getSettingValue(SettingsOptions::TemperatureInF)) {
if (newTemp > MAX_TEMP_F) if (newTemp > MAX_TEMP_F) {
newTemp = MAX_TEMP_F; newTemp = MAX_TEMP_F;
if (newTemp < MIN_TEMP_F) }
if (newTemp < MIN_TEMP_F) {
newTemp = MIN_TEMP_F; newTemp = MIN_TEMP_F;
}
} else { } else {
if (newTemp > MAX_TEMP_C) if (newTemp > MAX_TEMP_C) {
newTemp = MAX_TEMP_C; newTemp = MAX_TEMP_C;
if (newTemp < MIN_TEMP_C) }
if (newTemp < MIN_TEMP_C) {
newTemp = MIN_TEMP_C; newTemp = MIN_TEMP_C;
} }
}
setSettingValue(SettingsOptions::SolderingTemp, (uint16_t)newTemp); setSettingValue(SettingsOptions::SolderingTemp, (uint16_t)newTemp);
} }
if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2)) if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2)) {
return; // exit if user just doesn't press anything for a bit return; // exit if user just doesn't press anything for a bit
}
if (OLED::getRotation()) { if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE); OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
@@ -102,11 +107,7 @@ void gui_solderingTempAdjust(void) {
OLED::print(LargeSymbolSpace, FontStyle::LARGE); OLED::print(LargeSymbolSpace, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE); OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE);
if (getSettingValue(SettingsOptions::TemperatureInF)) OLED::printSymbolDeg(FontStyle::EXTRAS);
OLED::drawSymbol(0);
else {
OLED::drawSymbol(1);
}
OLED::print(LargeSymbolSpace, FontStyle::LARGE); OLED::print(LargeSymbolSpace, FontStyle::LARGE);
if (OLED::getRotation()) { if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE); OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);

View File

@@ -81,11 +81,12 @@ void showPDDebug(void) {
OLED::refresh(); OLED::refresh();
b = getButtonState(); b = getButtonState();
if (b == BUTTON_B_SHORT) if (b == BUTTON_B_SHORT) {
return; return;
else if (b == BUTTON_F_SHORT) { } else if (b == BUTTON_F_SHORT) {
screen++; screen++;
} }
GUIDelay(); GUIDelay();
} }
} }

View File

@@ -43,11 +43,12 @@ void showPDDebug(void) {
OLED::refresh(); OLED::refresh();
b = getButtonState(); b = getButtonState();
if (b == BUTTON_B_SHORT) if (b == BUTTON_B_SHORT) {
return; return;
else if (b == BUTTON_F_SHORT) { } else if (b == BUTTON_F_SHORT) {
screen++; screen++;
} }
GUIDelay(); GUIDelay();
} }
} }

View File

@@ -1,29 +1,14 @@
#include "OperatingModeUtilities.h" #include "OperatingModeUtilities.h"
#include "OperatingModes.h"
#include "TipThermoModel.h" #include "TipThermoModel.h"
void gui_drawTipTemp(bool symbol, const FontStyle font) { void gui_drawTipTemp(bool symbol, const FontStyle font) {
// Draw tip temp handling unit conversion & tolerance near setpoint // Draw tip temp handling unit conversion & tolerance near setpoint
uint32_t Temp = 0; uint16_t Temp = getTipTemp();
if (getSettingValue(SettingsOptions::TemperatureInF)) {
Temp = TipThermoModel::getTipInF();
} else {
Temp = TipThermoModel::getTipInC();
}
OLED::printNumber(Temp, 3, font); // Draw the tip temp out OLED::printNumber(Temp, 3, font); // Draw the tip temp out
if (symbol) { if (symbol) {
if (font == FontStyle::LARGE) { // For big font, can draw nice symbols, otherwise fall back to chars
// Big font, can draw nice symbols OLED::printSymbolDeg(font == FontStyle::LARGE ? FontStyle::EXTRAS : font);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::drawSymbol(0);
else
OLED::drawSymbol(1);
} else {
// Otherwise fall back to chars
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
} }
} }

View File

@@ -2,8 +2,8 @@
// Created by laura on 24.04.23. // Created by laura on 24.04.23.
// //
#include "OperatingModes.h"
#include "SolderingCommon.h" #include "SolderingCommon.h"
#include "OperatingModes.h"
extern bool heaterThermalRunaway; extern bool heaterThermalRunaway;
@@ -16,7 +16,8 @@ void detailedPowerStatus() {
// Print wattage // Print wattage
{ {
uint32_t x10Watt = x10WattHistory.average(); uint32_t x10Watt = x10WattHistory.average();
if (x10Watt > 999) { // If we exceed 99.9W we drop the decimal place to keep it all fitting if (x10Watt > 999) {
// If we exceed 99.9W we drop the decimal place to keep it all fitting
OLED::print(SmallSymbolSpace, FontStyle::SMALL); OLED::print(SmallSymbolSpace, FontStyle::SMALL);
OLED::printNumber(x10WattHistory.average() / 10, 3, FontStyle::SMALL); OLED::printNumber(x10WattHistory.average() / 10, 3, FontStyle::SMALL);
} else { } else {
@@ -42,30 +43,35 @@ void basicSolderingStatus(bool boostModeOn) {
if (OLED::getRotation()) { if (OLED::getRotation()) {
// battery // battery
gui_drawBatteryIcon(); gui_drawBatteryIcon();
OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp // Space out gap between battery <-> temp
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
// We draw boost arrow if boosting, or else gap temp <-> heat
// indicator
if (boostModeOn)
OLED::drawSymbol(2);
else
OLED::print(LargeSymbolSpace, FontStyle::LARGE); OLED::print(LargeSymbolSpace, FontStyle::LARGE);
// Draw current tip temp
gui_drawTipTemp(true, FontStyle::LARGE);
// We draw boost arrow if boosting,
// or else gap temp <-> heat indicator
if (boostModeOn) {
OLED::drawSymbol(2);
} else {
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
}
// Draw heating/cooling symbols // Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average())); OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
} else { } else {
// Draw heating/cooling symbols // Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average())); OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
// We draw boost arrow if boosting, or else gap temp <-> heat // We draw boost arrow if boosting,
// indicator // or else gap temp <-> heat indicator
if (boostModeOn) if (boostModeOn) {
OLED::drawSymbol(2); OLED::drawSymbol(2);
else } else {
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
}
// Draw current tip temp
gui_drawTipTemp(true, FontStyle::LARGE);
// Space out gap between battery <-> temp
OLED::print(LargeSymbolSpace, FontStyle::LARGE); OLED::print(LargeSymbolSpace, FontStyle::LARGE);
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
gui_drawBatteryIcon(); gui_drawBatteryIcon();
} }
@@ -154,3 +160,6 @@ int8_t getPowerSourceNumber(void) {
} }
return sourceNumber; return sourceNumber;
} }
// Returns temperature of the tip in *C/*F (based on user settings)
uint16_t getTipTemp(void) { return getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC(); }

View File

@@ -6,10 +6,11 @@ void gui_drawBatteryIcon(void) {
// On non-DC inputs we replace this symbol with the voltage we are operating on // On non-DC inputs we replace this symbol with the voltage we are operating on
// If <9V then show single digit, if not show dual small ones vertically stacked // If <9V then show single digit, if not show dual small ones vertically stacked
uint16_t V = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0); uint16_t V = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
if (V % 10 >= 5) if (V % 10 >= 5) {
V = (V / 10) + 1; // round up V = (V / 10) + 1; // round up
else } else {
V = V / 10; V = V / 10;
}
if (V > 9) { if (V > 9) {
int16_t xPos = OLED::getCursorX(); int16_t xPos = OLED::getCursorX();
OLED::printNumber(V / 10, 1, FontStyle::SMALL); OLED::printNumber(V / 10, 1, FontStyle::SMALL);
@@ -30,11 +31,13 @@ void gui_drawBatteryIcon(void) {
uint32_t cellV = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0) / cellCount; uint32_t cellV = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0) / cellCount;
// Should give us approx cell voltage X10 // Should give us approx cell voltage X10
// Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9 // Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9
if (cellV < getSettingValue(SettingsOptions::MinVoltageCells)) if (cellV < getSettingValue(SettingsOptions::MinVoltageCells)) {
cellV = getSettingValue(SettingsOptions::MinVoltageCells); cellV = getSettingValue(SettingsOptions::MinVoltageCells);
}
cellV -= getSettingValue(SettingsOptions::MinVoltageCells); // Should leave us a number of 0-9 cellV -= getSettingValue(SettingsOptions::MinVoltageCells); // Should leave us a number of 0-9
if (cellV > 9) if (cellV > 9) {
cellV = 9; cellV = 9;
}
OLED::drawBattery(cellV + 1); OLED::drawBattery(cellV + 1);
} else { } else {
OLED::drawSymbol(15); // Draw the DC Logo OLED::drawSymbol(15); // Draw the DC Logo

View File

@@ -7,10 +7,11 @@ uint32_t getSleepTimeout(void) {
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) { if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
uint32_t sleepThres = 0; uint32_t sleepThres = 0;
if (getSettingValue(SettingsOptions::SleepTime) < 6) if (getSettingValue(SettingsOptions::SleepTime) < 6) {
sleepThres = getSettingValue(SettingsOptions::SleepTime) * 10 * 1000; sleepThres = getSettingValue(SettingsOptions::SleepTime) * 10 * 1000;
else } else {
sleepThres = (getSettingValue(SettingsOptions::SleepTime) - 5) * 60 * 1000; sleepThres = (getSettingValue(SettingsOptions::SleepTime) - 5) * 60 * 1000;
}
return sleepThres; return sleepThres;
} }
return 0; return 0;

View File

@@ -3,8 +3,9 @@
#include "OperatingModeUtilities.h" #include "OperatingModeUtilities.h"
#include <stdint.h> #include <stdint.h>
uint16_t min(uint16_t a, uint16_t b) { uint16_t min(uint16_t a, uint16_t b) {
if (a > b) if (a > b) {
return b; return b;
else } else {
return a; return a;
}
} }

View File

@@ -26,8 +26,9 @@ bool shouldBeSleeping(bool inAutoStart) {
// threshold, and if so then we force sleep // threshold, and if so then we force sleep
if (getHallSensorFitted() && lookupHallEffectThreshold()) { if (getHallSensorFitted() && lookupHallEffectThreshold()) {
int16_t hallEffectStrength = getRawHallEffect(); int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0) if (hallEffectStrength < 0) {
hallEffectStrength = -hallEffectStrength; hallEffectStrength = -hallEffectStrength;
}
// Have absolute value of measure of magnetic field strength // Have absolute value of measure of magnetic field strength
if (hallEffectStrength > lookupHallEffectThreshold()) { if (hallEffectStrength > lookupHallEffectThreshold()) {
if (lastHallEffectSleepStart == 0) { if (lastHallEffectSleepStart == 0) {

View File

@@ -17,7 +17,6 @@
#include "stdlib.h" #include "stdlib.h"
#include "task.h" #include "task.h"
// Small worker thread to handle power (PD + QC) related steps // Small worker thread to handle power (PD + QC) related steps
void startPOWTask(void const *argument __unused) { void startPOWTask(void const *argument __unused) {

View File

@@ -8,13 +8,15 @@ ALL_PINECIL_V2_MODELS=Pinecilv2
ALL_MHP30_MODELS=MHP30 ALL_MHP30_MODELS=MHP30
ALL_SEQURE_MODELS=S60 ALL_SEQURE_MODELS=S60
ALL_MODELS=$(ALL_MINIWARE_MODELS) $(ALL_PINECIL_MODELS) $(ALL_MHP30_MODELS) $(ALL_PINECIL_V2_MODELS) $(ALL_SEQURE_MODELS) ALL_MODELS=$(ALL_MINIWARE_MODELS) $(ALL_PINECIL_MODELS) $(ALL_MHP30_MODELS) $(ALL_PINECIL_V2_MODELS) $(ALL_SEQURE_MODELS)
ifneq ($(model),$(filter $(model),$(ALL_MODELS))) ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS)) $(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
endif endif
# output folder # Output folder
HEXFILE_DIR=Hexfile HEXFILE_DIR=Hexfile
# temporary objects folder
# Temporary objects folder
OUTPUT_DIR_BASE=Objects OUTPUT_DIR_BASE=Objects
OUTPUT_DIR=Objects/$(model) OUTPUT_DIR=Objects/$(model)
@@ -24,7 +26,7 @@ LANGUAGE_GROUP_CJK_LANGS=EN JA_JP YUE_HK ZH_TW ZH_CN
LANGUAGE_GROUP_CJK_NAME=Chinese+Japanese LANGUAGE_GROUP_CJK_NAME=Chinese+Japanese
ifdef custom_multi_langs ifdef custom_multi_langs
RUN_SHELL_CMD := $(shell rm -Rf {Core/Gen,$(OUTPUT_DIR)/Core/Gen,$(HEXFILE_DIR)/*_Custom.*}) RUN_SHELL_CMD:=$(shell rm -Rf {Core/Gen,$(OUTPUT_DIR)/Core/Gen,$(HEXFILE_DIR)/*_Custom.*})
LANGUAGE_GROUP_CUSTOM_LANGS=$(custom_multi_langs) LANGUAGE_GROUP_CUSTOM_LANGS=$(custom_multi_langs)
LANGUAGE_GROUP_CUSTOM_NAME=Custom LANGUAGE_GROUP_CUSTOM_NAME=Custom
endif endif
@@ -37,7 +39,6 @@ LANGUAGE_GROUP_EUR_NAME=European
LANGUAGE_GROUPS=CUSTOM CJK CYRILLIC EUR LANGUAGE_GROUPS=CUSTOM CJK CYRILLIC EUR
# Define for host Python # Define for host Python
ifndef HOST_PYTHON ifndef HOST_PYTHON
HOST_PYTHON:=python3 HOST_PYTHON:=python3
@@ -45,150 +46,177 @@ endif
# Defines for host tools # Defines for host tools
ifeq ($(HOST_CC),) ifeq ($(HOST_CC),)
HOST_CC := gcc HOST_CC:=gcc
endif endif
HOST_OUTPUT_DIR=Objects/host HOST_OUTPUT_DIR=Objects/host
# DFU packing address to use # DFU packing address to use
DEVICE_DFU_ADDRESS=0x08000000 DEVICE_DFU_ADDRESS=0x08000000
DEVICE_DFU_VID_PID=0x28E9:0x0189 DEVICE_DFU_VID_PID=0x28E9:0x0189
# Enumerate all of the include directories
APP_INC_DIR = ./Core/Inc
BRIEFLZ_INC_DIR = ./Core/brieflz
MINIWARE_INC_CMSIS_DEVICE = ./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx/Include
MINIWARE_CMSIS_CORE_INC_DIR = ./Core/BSP/Miniware/Vendor/CMSIS/Include
MINIWARE_HAL_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
MINIWARE_HAL_LEGACY_INC_DIR = ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MINIWARE_STARTUP_DIR = ./Startup
MINIWARE_INC_DIR = ./Core/BSP/Miniware
MINIWARE_LD_FILE = ./Core/BSP/Miniware/stm32f103.ld
S60_INC_CMSIS_DEVICE = ./Core/BSP/Sequre_S60/Vendor/CMSIS/Device/ST/STM32F1xx/Include # Enumerate all of the include directories (HAL source dirs are used for clang-format only)
S60_CMSIS_CORE_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/CMSIS/Include APP_INC_DIR=./Core/Inc
S60_HAL_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc BRIEFLZ_INC_DIR=./Core/brieflz
S60_HAL_LEGACY_INC_DIR = ./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy MINIWARE_INC_CMSIS_DEVICE=./Core/BSP/Miniware/Vendor/CMSIS/Device/ST/STM32F1xx/Include
S60_STARTUP_DIR = ./Startup MINIWARE_CMSIS_CORE_INC_DIR=./Core/BSP/Miniware/Vendor/CMSIS/Include
S60_INC_DIR = ./Core/BSP/Sequre_S60 MINIWARE_HAL_SRC_DIR= ./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver
S60_LD_FILE = ./Core/BSP/Sequre_S60/stm32f103.ld MINIWARE_HAL_INC_DIR=./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc
MINIWARE_HAL_LEGACY_INC_DIR=./Core/BSP/Miniware/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MINIWARE_STARTUP_DIR=./Startup
MINIWARE_INC_DIR=./Core/BSP/Miniware
MINIWARE_LD_FILE=./Core/BSP/Miniware/stm32f103.ld
MHP30_INC_CMSIS_DEVICE = ./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Include S60_INC_CMSIS_DEVICE=./Core/BSP/Sequre_S60/Vendor/CMSIS/Device/ST/STM32F1xx/Include
MHP30_CMSIS_CORE_INC_DIR = ./Core/BSP/MHP30/Vendor/CMSIS/Include S60_CMSIS_CORE_INC_DIR=./Core/BSP/Sequre_S60/Vendor/CMSIS/Include
MHP30_HAL_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc S60_HAL_SRC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver
MHP30_HAL_LEGACY_INC_DIR = ./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy S60_HAL_INC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc
MHP30_STARTUP_DIR = ./Startup S60_HAL_LEGACY_INC_DIR=./Core/BSP/Sequre_S60/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MHP30_INC_DIR = ./Core/BSP/MHP30 S60_STARTUP_DIR=./Startup
MHP30_LD_FILE = ./Core/BSP/MHP30/stm32f103.ld S60_INC_DIR=./Core/BSP/Sequre_S60
S60_LD_FILE=./Core/BSP/Sequre_S60/stm32f103.ld
PINE_INC_DIR = ./Core/BSP/Pinecil MHP30_INC_CMSIS_DEVICE=./Core/BSP/MHP30/Vendor/CMSIS/Device/ST/STM32F1xx/Include
PINE_VENDOR_INC_DIR = ./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include MHP30_CMSIS_CORE_INC_DIR=./Core/BSP/MHP30/Vendor/CMSIS/Include
PINE_VENDOR_USB_INC_DIR = ./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include/Usb MHP30_HAL_SRC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver
PINE_NMSIS_INC_DIR = ./Core/BSP/Pinecil/Vendor/NMSIS/Core/Include MHP30_HAL_INC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc
PINE_FREERTOS_PORT_INC_DIR = ./Core/BSP/Pinecil/Vendor/OS/FreeRTOS/Source/portable/GCC MHP30_HAL_LEGACY_INC_DIR=./Core/BSP/MHP30/Vendor/STM32F1xx_HAL_Driver/Inc/Legacy
MHP30_STARTUP_DIR=./Startup
MHP30_INC_DIR=./Core/BSP/MHP30
MHP30_LD_FILE=./Core/BSP/MHP30/stm32f103.ld
PINECILV2_DIR = ./Core/BSP/Pinecilv2 PINE_INC_DIR=./Core/BSP/Pinecil
PINECILV2_SDK_DIR = $(PINECILV2_DIR)/bl_mcu_sdk PINE_VENDOR_SRC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Source
PINE_VENDOR_INC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include
PINE_VENDOR_USB_INC_DIR=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Common/Include/Usb
PINE_NMSIS_INC_DIR=./Core/BSP/Pinecil/Vendor/NMSIS/Core/Include
PINE_FREERTOS_PORT_INC_DIR=./Core/BSP/Pinecil/Vendor/OS/FreeRTOS/Source/portable/GCC
PINECILV2_VENDOR_BSP_DIR = $(PINECILV2_SDK_DIR)/bsp PINECILV2_DIR=./Core/BSP/Pinecilv2
PINECILV2_VENDOR_BSP_COMMON_DIR = $(PINECILV2_VENDOR_BSP_DIR)/bsp_common PINECILV2_MEM_DIR=$(PINECILV2_DIR)/MemMang
PINECILV2_VENDOR_BSP_BOARD_DIR = $(PINECILV2_VENDOR_BSP_DIR)/board PINECILV2_SDK_DIR=$(PINECILV2_DIR)/bl_mcu_sdk
PINECILV2_VENDOR_BSP_PLATFORM_DIR = $(PINECILV2_VENDOR_BSP_COMMON_DIR)/platform
PINECILV2_VENDOR_BSP_USB_DIR = $(PINECILV2_VENDOR_BSP_COMMON_DIR)/usb
PINECILV2_VENDOR_BSP_DIR=$(PINECILV2_SDK_DIR)/bsp
PINECILV2_VENDOR_BSP_COMMON_DIR=$(PINECILV2_VENDOR_BSP_DIR)/bsp_common
PINECILV2_VENDOR_BSP_BOARD_DIR=$(PINECILV2_VENDOR_BSP_DIR)/board
PINECILV2_VENDOR_BSP_PLATFORM_DIR=$(PINECILV2_VENDOR_BSP_COMMON_DIR)/platform
PINECILV2_VENDOR_BSP_USB_DIR=$(PINECILV2_VENDOR_BSP_COMMON_DIR)/usb
PINECILV2_COMMON_DIR = $(PINECILV2_SDK_DIR)/common PINECILV2_COMMON_DIR=$(PINECILV2_SDK_DIR)/common
PINECILV2_COMMON_BL_MATH_DIR = $(PINECILV2_COMMON_DIR)/bl_math PINECILV2_COMMON_BL_MATH_DIR=$(PINECILV2_COMMON_DIR)/bl_math
PINECILV2_COMMON_DEVICE_DIR = $(PINECILV2_COMMON_DIR)/device PINECILV2_COMMON_DEVICE_DIR=$(PINECILV2_COMMON_DIR)/device
PINECILV2_COMMON_LIST_DIR = $(PINECILV2_COMMON_DIR)/list PINECILV2_COMMON_LIST_DIR=$(PINECILV2_COMMON_DIR)/list
PINECILV2_COMMON_MISC_DIR = $(PINECILV2_COMMON_DIR)/misc PINECILV2_COMMON_MISC_DIR=$(PINECILV2_COMMON_DIR)/misc
PINECILV2_COMMON_PARTITION_DIR = $(PINECILV2_COMMON_DIR)/partition PINECILV2_COMMON_PARTITION_DIR=$(PINECILV2_COMMON_DIR)/partition
PINECILV2_COMMON_PID_DIR = $(PINECILV2_COMMON_DIR)/pid PINECILV2_COMMON_PID_DIR=$(PINECILV2_COMMON_DIR)/pid
PINECILV2_COMMON_RING_BUFFERDIR = $(PINECILV2_COMMON_DIR)/ring_buffer PINECILV2_COMMON_RING_BUFFERDIR=$(PINECILV2_COMMON_DIR)/ring_buffer
PINECILV2_COMMON_SOFT_CRC_DIR = $(PINECILV2_COMMON_DIR)/soft_crc PINECILV2_COMMON_SOFT_CRC_DIR=$(PINECILV2_COMMON_DIR)/soft_crc
PINECILV2_COMMON_TIMESTAMP_DIR = $(PINECILV2_COMMON_DIR)/timestamp PINECILV2_COMMON_TIMESTAMP_DIR=$(PINECILV2_COMMON_DIR)/timestamp
PINECILV2_COMPONENTS_DIR = $(PINECILV2_SDK_DIR)/components
PINECILV2_COMPONENTS_DIR=$(PINECILV2_SDK_DIR)/components
PINECILV2_COMPONENTS_FREERTOS_DIR=$(PINECILV2_COMPONENTS_DIR)/freertos
PINECILV2_COMPONENTS_FREERTOS_BL602_DIR=$(PINECILV2_COMPONENTS_FREERTOS_DIR)/portable/gcc/risc-v/bl702
PINECILV2_COMPONENTS_FREERTOS_DIR = $(PINECILV2_COMPONENTS_DIR)/freertos PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/port/include
PINECILV2_COMPONENTS_FREERTOS_BL602_DIR = $(PINECILV2_COMPONENTS_FREERTOS_DIR)/portable/gcc/risc-v/bl702 PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers/bluetooth
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/bluetooth
PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common
PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/misc
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/zephyr
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/net
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/toolchain
PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include
PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include/tinycrypt
PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/host
PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/bl_hci_wrapper
PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/ble_inc
PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/sbc/dec
PINECILV2_COMPONENTS_BLE_STACK_PORT_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/port/include # Binary blobs suck and they should be ashamed
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_DRIVERS_BLUETOOTH_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/drivers/bluetooth
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_BLUETOOTH_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/include/bluetooth
PINECILV2_COMPONENTS_BLE_STACK_COMMON_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common
PINECILV2_COMPONENTS_BLE_STACK_COMMON_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_MISC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/misc
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_ZEPHYR_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/zephyr
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_NET_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/net
PINECILV2_COMPONENTS_BLE_STACK_INCLUDE_TOOLCHAIN_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/include/toolchain
PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include
PINECILV2_COMPONENTS_BLE_STACK_TINYCRYPT_INCLUDE_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/common/tinycrypt/include/tinycrypt
PINECILV2_COMPONENTS_BLE_STACK_HOST_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/host
PINECILV2_COMPONENTS_BLE_STACK_BL_HCI_WRAPPER_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/bl_hci_wrapper
PINECILV2_COMPONENTS_BLE_CONTROLLER_BLE_INC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/ble_inc
PINECILV2_COMPONENTS_BLE_STACK_BC_DEC_DIR = $(PINECILV2_COMPONENTS_DIR)/ble/ble_stack/sbc/dec
#Binary blobs suck and they should be ashamed
PINECILV2_BLE_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/lib PINECILV2_BLE_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/blecontroller/lib
PINECILV2_RF_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/bl702_rf/lib PINECILV2_RF_CRAPWARE_BLOB_DIR=$(PINECILV2_COMPONENTS_DIR)/ble/bl702_rf/lib
PINECILV2_COMPONENTS_NMSIS_DIR=$(PINECILV2_COMPONENTS_DIR)/nmsis
PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR=$(PINECILV2_COMPONENTS_NMSIS_DIR)/core/inc
PINECILV2_COMPONENTS_NMSIS_DIR = $(PINECILV2_COMPONENTS_DIR)/nmsis PINECILV2_COMPONENTS_USB_STACK_DIR=$(PINECILV2_COMPONENTS_DIR)/usb_stack
PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR = $(PINECILV2_COMPONENTS_NMSIS_DIR)/core/inc PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/common
PINECILV2_COMPONENTS_USB_STACK_CORE_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/core
PINECILV2_COMPONENTS_USB_STACK_CDC_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/cdc
PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR=$(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/winusb
PINECILV2_COMPONENTS_USB_STACK_DIR = $(PINECILV2_COMPONENTS_DIR)/usb_stack PINECILV2_DRIVERS_DIR=$(PINECILV2_SDK_DIR)/drivers/bl702_driver
PINECILV2_COMPONENTS_USB_STACK_COMMON_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/common PINECILV2_DRIVERS_HAL_DRV_INC_DIR=$(PINECILV2_DRIVERS_DIR)/hal_drv/inc
PINECILV2_COMPONENTS_USB_STACK_CORE_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/core PINECILV2_DRIVERS_HAL_DRV_DEF_DIR=$(PINECILV2_DRIVERS_DIR)/hal_drv/default_config
PINECILV2_COMPONENTS_USB_STACK_CDC_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/cdc PINECILV2_DRIVERS_REGS_DIR=$(PINECILV2_DRIVERS_DIR)/regs
PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR = $(PINECILV2_COMPONENTS_USB_STACK_DIR)/class/winusb PINECILV2_DRIVERS_RISCV_DIR=$(PINECILV2_DRIVERS_DIR)/risc-v
PINECILV2_DRIVERS_STARTUP_DIR=$(PINECILV2_DRIVERS_DIR)/startup
PINECILV2_DRIVERS_STD_DRV_DIR=$(PINECILV2_DRIVERS_DIR)/std_drv/inc
PINECILV2_DRIVERS_DIR = $(PINECILV2_SDK_DIR)/drivers/bl702_driver SOURCE_MIDDLEWARES_DIR=./Middlewares
PINECILV2_DRIVERS_HAL_DRV_INC_DIR = $(PINECILV2_DRIVERS_DIR)/hal_drv/inc FRTOS_CMIS_INC_DIR=./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
PINECILV2_DRIVERS_HAL_DRV_DEF_DIR = $(PINECILV2_DRIVERS_DIR)/hal_drv/default_config FRTOS_INC_DIR=./Middlewares/Third_Party/FreeRTOS/Source/include
PINECILV2_DRIVERS_REGS_DIR = $(PINECILV2_DRIVERS_DIR)/regs DRIVER_INC_DIR=./Core/Drivers
PINECILV2_DRIVERS_RISCV_DIR = $(PINECILV2_DRIVERS_DIR)/risc-v BSP_INC_DIR=./Core/BSP
PINECILV2_DRIVERS_STARTUP_DIR = $(PINECILV2_DRIVERS_DIR)/startup THREADS_INC_DIR=./Core/Threads
PINECILV2_DRIVERS_STD_DRV_DIR = $(PINECILV2_DRIVERS_DIR)/std_drv/inc THREADS_OP_MODES_INC_DIR=./Core/Threads/OperatingModes
THREADS_OP_MODES_TOOLS_INC_DIR=./Core/Threads/OperatingModes/utils
SOURCE_THREADS_DIR=./Core/Threads
SOURCE_CORE_DIR=./Core/Src
SOURCE_BRIEFLZ_DIR=./Core/brieflz
SOURCE_DRIVERS_DIR=./Core/Drivers
INC_PD_DRIVERS_DIR=./Core/Drivers/usb-pd/include
PD_DRIVER_TESTS_DIR=./Core/Drivers/usb-pd/tests
PD_DRIVER_DIR=./Core/Drivers/usb-pd
# Excludes for clang-format
ALL_INCLUDES_EXCEPT:=-path $(BRIEFLZ_INC_DIR) \
-o -path $(PD_DRIVER_DIR) \
-o -path $(PINECILV2_SDK_DIR) \
-o -path $(DRIVER_INC_DIR) \
-o -path $(MINIWARE_HAL_INC_DIR) \
-o -path $(S60_HAL_INC_DIR) \
-o -path $(MHP30_HAL_INC_DIR) \
-o -path $(PINE_VENDOR_INC_DIR) \
-o -path $(MINIWARE_CMSIS_CORE_INC_DIR) \
-o -path $(S60_CMSIS_CORE_INC_DIR) \
-o -path $(MINIWARE_INC_CMSIS_DEVICE) \
-o -path $(S60_INC_CMSIS_DEVICE) \
-o -path $(MHP30_INC_CMSIS_DEVICE) \
-o -not -name "configuration.h"
SOURCE_MIDDLEWARES_DIR = ./Middlewares ALL_SOURCE_EXCEPT:=-path $(SOURCE_BRIEFLZ_DIR) \
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -o -path $(PD_DRIVER_DIR) \
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include -o -path $(PINECILV2_SDK_DIR) \
DRIVER_INC_DIR =./Core/Drivers -o -path $(SOURCE_DRIVERS_DIR) \
BSP_INC_DIR = ./Core/BSP -o -path $(MINIWARE_HAL_SRC_DIR) \
THREADS_INC_DIR = ./Core/Threads -o -path $(S60_HAL_SRC_DIR) \
THREADS_OP_MODES_INC_DIR = ./Core/Threads/OperatingModes -o -path $(MHP30_HAL_SRC_DIR) \
THREADS_OP_MODES_TOOLS_INC_DIR = ./Core/Threads/OperatingModes/utils -o -path $(PINE_VENDOR_SRC_DIR) \
-o -path $(PINECILV2_MEM_DIR)
SOURCE_THREADS_DIR = ./Core/Threads
SOURCE_CORE_DIR = ./Core/Src
SOURCE_BRIEFLZ_DIR = ./Core/brieflz
SOURCE_DRIVERS_DIR = ./Core/Drivers
INC_PD_DRIVERS_DIR = ./Core/Drivers/usb-pd/include
PD_DRIVER_TESTS_DIR = ./Core/Drivers/usb-pd/tests
PD_DRIVER_DIR = ./Core/Drivers/usb-pd
# Find-all's used for formatting; have to exclude external modules # Find-all's used for formatting; have to exclude external modules
ALL_INCLUDES=$(shell find ./Core -type d \( $(ALL_INCLUDES_EXCEPT) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) )
ALL_INCLUDES = $(shell find ./Core -type d \( -path $(BRIEFLZ_INC_DIR) -o -path $(PD_DRIVER_DIR) -o -path $(PINECILV2_SDK_DIR) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) ) ALL_SOURCE=$(shell find ./Core -type d \( $(ALL_SOURCE_EXCEPT) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
ALL_SOURCE = $(shell find ./Core -type d \( -path $(SOURCE_BRIEFLZ_DIR) -o -path $(PD_DRIVER_DIR) -o -path $(PINECILV2_SDK_DIR) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
# Device dependent settings # Device dependent settings
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS))) ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS)))
$(info Building for Miniware ) $(info Building for Miniware )
DEVICE_INCLUDES = -I$(MINIWARE_INC_DIR) \ DEVICE_INCLUDES=-I$(MINIWARE_INC_DIR) \
-I$(MINIWARE_INC_CMSIS_DEVICE)\ -I$(MINIWARE_INC_CMSIS_DEVICE) \
-I$(MINIWARE_CMSIS_CORE_INC_DIR) \ -I$(MINIWARE_CMSIS_CORE_INC_DIR) \
-I$(MINIWARE_HAL_INC_DIR) \ -I$(MINIWARE_HAL_INC_DIR) \
-I$(MINIWARE_HAL_LEGACY_INC_DIR) -I$(MINIWARE_HAL_LEGACY_INC_DIR)
DEVICE_BSP_DIR = ./Core/BSP/Miniware
S_SRCS := $(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S') DEVICE_BSP_DIR=./Core/BSP/Miniware
S_SRCS:=$(shell find $(MINIWARE_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(MINIWARE_LD_FILE) LDSCRIPT=$(MINIWARE_LD_FILE)
ifeq ($(model),$(filter $(model),TS101)) ifeq ($(model),$(filter $(model),TS101))
flash_size=126k flash_size=126k
bootldr_size=0x8000 bootldr_size=0x8000
@@ -199,105 +227,133 @@ bootldr_size=0x4000
DEVICE_DFU_ADDRESS=0x08004000 DEVICE_DFU_ADDRESS=0x08004000
endif endif
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \ DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
-D STM32F1 \
-D STM32 \
-D USE_HAL_DRIVER \
-D STM32F103xB \
-D USE_RTOS_SYSTICK \
-D GCC_ARMCM3 \
-D ARM_MATH_CM3 \ -D ARM_MATH_CM3 \
-D STM32F10X_MD -finline-limit=9999999 -D STM32F10X_MD \
DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning -finline-limit=9999999
DEV_LDFLAGS=-Wl,--wrap=printf -Wl,--no-wchar-size-warning
DEV_AFLAGS= DEV_AFLAGS=
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
DEV_CXXFLAGS= DEV_CXXFLAGS=
CPUFLAGS= -mcpu=cortex-m3 \ CPUFLAGS=-mcpu=cortex-m3 \
-mthumb \ -mthumb \
-mfloat-abi=soft -mfloat-abi=soft
DEVICE_DFU_VID_PID=0x1209:0xDB42 DEVICE_DFU_VID_PID=0x1209:0xDB42
endif endif # ALL_MINIWARE_MODELS
ifeq ($(model),$(filter $(model),$(ALL_SEQURE_MODELS))) ifeq ($(model),$(filter $(model),$(ALL_SEQURE_MODELS)))
$(info Building for Sequre ) $(info Building for Sequre )
DEVICE_INCLUDES = -I$(S60_INC_DIR) \ DEVICE_INCLUDES=-I$(S60_INC_DIR) \
-I$(S60_INC_CMSIS_DEVICE)\ -I$(S60_INC_CMSIS_DEVICE) \
-I$(S60_CMSIS_CORE_INC_DIR) \ -I$(S60_CMSIS_CORE_INC_DIR) \
-I$(S60_HAL_INC_DIR) \ -I$(S60_HAL_INC_DIR) \
-I$(S60_HAL_LEGACY_INC_DIR) -I$(S60_HAL_LEGACY_INC_DIR)
DEVICE_BSP_DIR = ./Core/BSP/Sequre_S60
S_SRCS := $(shell find $(S60_STARTUP_DIR) -type f -name '*.S') DEVICE_BSP_DIR=./Core/BSP/Sequre_S60
S_SRCS:=$(shell find $(S60_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(S60_LD_FILE) LDSCRIPT=$(S60_LD_FILE)
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \ DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
-D STM32F1 \
-D STM32 \
-D USE_HAL_DRIVER \
-D STM32F103xB \
-D USE_RTOS_SYSTICK \
-D GCC_ARMCM3 \
-D ARM_MATH_CM3 \ -D ARM_MATH_CM3 \
-D STM32F10X_MD -finline-limit=9999999 -D STM32F10X_MD \
DEV_LDFLAGS= -Wl,--wrap=printf -Wl,--no-wchar-size-warning -finline-limit=9999999
DEV_LDFLAGS=-Wl,--wrap=printf -Wl,--no-wchar-size-warning
DEV_AFLAGS= DEV_AFLAGS=
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
DEV_CXXFLAGS= DEV_CXXFLAGS=
CPUFLAGS= -mcpu=cortex-m3 \ CPUFLAGS=-mcpu=cortex-m3 \
-mthumb \ -mthumb \
-mfloat-abi=soft -mfloat-abi=soft
flash_size=62k flash_size=62k
bootldr_size=0x4400 bootldr_size=0x4400
DEVICE_DFU_ADDRESS=0x08004400 DEVICE_DFU_ADDRESS=0x08004400
DEVICE_DFU_VID_PID=0x1209:0xDB42 DEVICE_DFU_VID_PID=0x1209:0xDB42
endif endif # ALL_SEQURE_MODELS
ifeq ($(model),$(filter $(model),$(ALL_MHP30_MODELS))) ifeq ($(model),$(filter $(model),$(ALL_MHP30_MODELS)))
$(info Building for MHP30 ) $(info Building for MHP30 )
DEVICE_INCLUDES = -I$(MHP30_INC_DIR) \ DEVICE_INCLUDES=-I$(MHP30_INC_DIR) \
-I$(MHP30_INC_CMSIS_DEVICE)\ -I$(MHP30_INC_CMSIS_DEVICE) \
-I$(MHP30_CMSIS_CORE_INC_DIR) \ -I$(MHP30_CMSIS_CORE_INC_DIR) \
-I$(MHP30_HAL_INC_DIR) \ -I$(MHP30_HAL_INC_DIR) \
-I$(MHP30_HAL_LEGACY_INC_DIR) -I$(MHP30_HAL_LEGACY_INC_DIR)
DEVICE_BSP_DIR = ./Core/BSP/MHP30
S_SRCS := $(shell find $(MHP30_STARTUP_DIR) -type f -name '*.S') DEVICE_BSP_DIR=./Core/BSP/MHP30
S_SRCS:=$(shell find $(MHP30_STARTUP_DIR) -type f -name '*.S')
LDSCRIPT=$(MHP30_LD_FILE) LDSCRIPT=$(MHP30_LD_FILE)
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \ DEV_GLOBAL_DEFS=-D STM32F103T8Ux \
-D STM32F1 \
-D STM32 \
-D USE_HAL_DRIVER \
-D STM32F103xB \
-D USE_RTOS_SYSTICK \
-D GCC_ARMCM3 \
-D ARM_MATH_CM3 \ -D ARM_MATH_CM3 \
-D STM32F10X_MD -D STM32F10X_MD
DEV_LDFLAGS= DEV_LDFLAGS=
DEV_AFLAGS= DEV_AFLAGS=
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
DEV_CXXFLAGS= DEV_CXXFLAGS=
CPUFLAGS= -mcpu=cortex-m3 \ CPUFLAGS=-mcpu=cortex-m3 \
-mthumb \ -mthumb \
-mfloat-abi=soft -mfloat-abi=soft
flash_size=126k flash_size=126k
bootldr_size=32k bootldr_size=32k
DEVICE_DFU_ADDRESS=0x08008000 DEVICE_DFU_ADDRESS=0x08008000
DEVICE_DFU_VID_PID=0x1209:0xDB42 DEVICE_DFU_VID_PID=0x1209:0xDB42
endif endif # ALL_MHP30_MODELS
ifeq ($(model),$(ALL_PINECIL_MODELS)) ifeq ($(model),$(ALL_PINECIL_MODELS))
$(info Building for Pine64 Pinecilv1) $(info Building for Pine64 Pinecilv1)
DEVICE_INCLUDES = -I$(PINE_INC_DIR) \ DEVICE_INCLUDES=-I$(PINE_INC_DIR) \
-I$(PINE_VENDOR_INC_DIR) \ -I$(PINE_VENDOR_INC_DIR) \
-I$(PINE_VENDOR_USB_INC_DIR) \ -I$(PINE_VENDOR_USB_INC_DIR) \
-I$(PINE_NMSIS_INC_DIR) \ -I$(PINE_NMSIS_INC_DIR) \
-I$(PINE_FREERTOS_PORT_INC_DIR) -I$(PINE_FREERTOS_PORT_INC_DIR)
DEVICE_BSP_DIR = ./Core/BSP/Pinecil DEVICE_BSP_DIR=./Core/BSP/Pinecil
S_SRCS := $(shell find $(PINE_INC_DIR) -type f -name '*.S') $(info $(S_SRCS) ) S_SRCS:=$(shell find $(PINE_INC_DIR) -type f -name '*.S') $(info $(S_SRCS) )
ASM_INC = -I$(PINE_RISCV_INC_DIR) ASM_INC=-I$(PINE_RISCV_INC_DIR)
LDSCRIPT=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Board/pinecil/Source/GCC/gcc_gd32vf103_flashxip.ld LDSCRIPT=./Core/BSP/Pinecil/Vendor/SoC/gd32vf103/Board/pinecil/Source/GCC/gcc_gd32vf103_flashxip.ld
flash_size=128k flash_size=128k
bootldr_size=0x0 bootldr_size=0x0
# Flags # Flags
CPUFLAGS= -march=rv32imac \ CPUFLAGS=-march=rv32imac \
-mabi=ilp32 \ -mabi=ilp32 \
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles -mcmodel=medany \
-fsigned-char \
-fno-builtin \
-nostartfiles
DEV_LDFLAGS=-nostartfiles DEV_LDFLAGS=-nostartfiles
DEV_AFLAGS= DEV_AFLAGS=
DEV_GLOBAL_DEFS= -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP DEV_GLOBAL_DEFS=-DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
DEV_CFLAGS= -D VECT_TAB_OFFSET=$(bootldr_size)U DEV_CFLAGS=-D VECT_TAB_OFFSET=$(bootldr_size)U
DEV_CXXFLAGS= DEV_CXXFLAGS=
endif endif # ALL_PINECIL_MODELS
ifeq ($(model),$(ALL_PINECIL_V2_MODELS)) ifeq ($(model),$(ALL_PINECIL_V2_MODELS))
$(info Building for Pine64 Pinecilv2 ) $(info Building for Pine64 Pinecilv2 )
DEVICE_INCLUDES=-I$(PINECILV2_DIR) \
DEVICE_INCLUDES = -I$(PINECILV2_DIR) \
-I$(PINECILV2_SDK_DIR) \ -I$(PINECILV2_SDK_DIR) \
-I$(PINECILV2_VENDOR_BSP_COMMON_DIR) \ -I$(PINECILV2_VENDOR_BSP_COMMON_DIR) \
-I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \ -I$(PINECILV2_VENDOR_BSP_PLATFORM_DIR) \
@@ -349,71 +405,83 @@ DEVICE_INCLUDES = -I$(PINECILV2_DIR) \
-I$(PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR) \ -I$(PINECILV2_COMPONENTS_USB_STACK_WINUSB_DIR) \
-I$(PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR) -I$(PINECILV2_COMPONENTS_NMSIS_CORE_INC_DIR)
DEVICE_BSP_DIR = ./Core/BSP/Pinecilv2 DEVICE_BSP_DIR=./Core/BSP/Pinecilv2
S_SRCS := $(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) ) S_SRCS:=$(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) )
ASM_INC = $(DEVICE_INCLUDES) ASM_INC=$(DEVICE_INCLUDES)
LDSCRIPT=./Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld LDSCRIPT=./Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
# Flags # Flags
CPUFLAGS= -march=rv32imafc \ CPUFLAGS=-march=rv32imafc \
-mabi=ilp32f \ -mabi=ilp32f \
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles \ -mcmodel=medany \
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler -DARCH_RISCV -D__RISCV_FEATURE_MVE=0 -DBL702 -DBFLB_USE_ROM_DRIVER=1 -fsigned-char \
DEV_LDFLAGS=-nostartfiles -L $(PINECILV2_BLE_CRAPWARE_BLOB_DIR) -L $(PINECILV2_RF_CRAPWARE_BLOB_DIR) -l blecontroller_702_m0s1s -l bl702_rf -fno-builtin \
-nostartfiles \
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \
-DARCH_RISCV \
-D__RISCV_FEATURE_MVE=0 \
-DBL702 \
-DBFLB_USE_ROM_DRIVER=1 \
DEV_LDFLAGS=-nostartfiles \
-L $(PINECILV2_BLE_CRAPWARE_BLOB_DIR) \
-L $(PINECILV2_RF_CRAPWARE_BLOB_DIR) \
-l blecontroller_702_m0s1s \
-l bl702_rf
DEV_AFLAGS= DEV_AFLAGS=
DEV_GLOBAL_DEFS= -DCFG_FREERTOS \ DEV_GLOBAL_DEFS=-DCFG_FREERTOS \
-DARCH_RISCV \ -DARCH_RISCV \
-DBL702 \ -DBL702 \
-DCFG_BLE_ENABLE \ -DCFG_BLE_ENABLE \
-DBFLB_BLE \ -DBFLB_BLE \
-DCFG_BLE \ -DCFG_BLE \
-DOPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER \ -DOPTIMIZE_DATA_EVT_FLOW_FROM_CONTROLLER \
-DBL_MCU_SDK \ -DBL_MCU_SDK \
-DCFG_CON=2 \ -DCFG_CON=2 \
-DCFG_BLE_TX_BUFF_DATA=2 \ -DCFG_BLE_TX_BUFF_DATA=2 \
-DCONFIG_BT_PERIPHERAL \ -DCONFIG_BT_PERIPHERAL \
-DCONFIG_BT_L2CAP_DYNAMIC_CHANNEL \ -DCONFIG_BT_L2CAP_DYNAMIC_CHANNEL \
-DCONFIG_BT_GATT_CLIENT \ -DCONFIG_BT_GATT_CLIENT \
-DCONFIG_BT_CONN \ -DCONFIG_BT_CONN \
-DCONFIG_BT_GATT_DIS_PNP \ -DCONFIG_BT_GATT_DIS_PNP \
-DCONFIG_BT_GATT_DIS_SERIAL_NUMBER \ -DCONFIG_BT_GATT_DIS_SERIAL_NUMBER \
-DCONFIG_BT_GATT_DIS_FW_REV \ -DCONFIG_BT_GATT_DIS_FW_REV \
-DCONFIG_BT_GATT_DIS_HW_REV \ -DCONFIG_BT_GATT_DIS_HW_REV \
-DCONFIG_BT_GATT_DIS_SW_REV \ -DCONFIG_BT_GATT_DIS_SW_REV \
-DCONFIG_BT_ECC \ -DCONFIG_BT_ECC \
-DCONFIG_BT_GATT_DYNAMIC_DB \ -DCONFIG_BT_GATT_DYNAMIC_DB \
-DCONFIG_BT_GATT_SERVICE_CHANGED \ -DCONFIG_BT_GATT_SERVICE_CHANGED \
-DCONFIG_BT_KEYS_OVERWRITE_OLDEST \ -DCONFIG_BT_KEYS_OVERWRITE_OLDEST \
-DCONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING \ -DCONFIG_BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING \
-DCONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS \ -DCONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS \
-DCONFIG_BT_BONDABLE \ -DCONFIG_BT_BONDABLE \
-DCONFIG_BT_HCI_VS_EVT_USER \ -DCONFIG_BT_HCI_VS_EVT_USER \
-DCONFIG_BT_ASSERT \ -DCONFIG_BT_ASSERT \
-DCONFIG_BT_SIGNING \ -DCONFIG_BT_SIGNING \
-DCONFIG_BT_SETTINGS_CCC_LAZY_LOADING \ -DCONFIG_BT_SETTINGS_CCC_LAZY_LOADING \
-DCONFIG_BT_SETTINGS_USE_PRINTK \ -DCONFIG_BT_SETTINGS_USE_PRINTK \
-DCFG_SLEEP \ -DCFG_SLEEP \
-DCONFIG_BT_ALLROLES \ -DCONFIG_BT_ALLROLES \
-DCONFIG_BT_CENTRAL \ -DCONFIG_BT_CENTRAL \
-DCONFIG_BT_OBSERVER \ -DCONFIG_BT_OBSERVER \
-DCONFIG_BT_BROADCASTER \ -DCONFIG_BT_BROADCASTER \
-DCFG_BLE_STACK_DBG_PRINT \ -DCFG_BLE_STACK_DBG_PRINT \
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \ -DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler \
-DCONFIG_BT_DEVICE_NAME=\"Pinecil\" \ -DCONFIG_BT_DEVICE_NAME=\"Pinecil\" \
-DCONFIG_BT_DEVICE_APPEARANCE=0x06C1 -DCONFIG_BT_DEVICE_APPEARANCE=0x06C1
# -DBFLB_USE_HAL_DRIVER # -DBFLB_USE_HAL_DRIVER \
# -DCONFIG_BT_SMP \ # -DCONFIG_BT_SMP
# Required to be turned off due to their drivers tripping warnings
#Required to be turned off due to their drivers tripping warnings
DEV_CFLAGS= -Wno-error=enum-conversion -Wno-type-limits -Wno-implicit-fallthrough DEV_CFLAGS= -Wno-error=enum-conversion -Wno-type-limits -Wno-implicit-fallthrough
DEV_CXXFLAGS= $(DEV_CFLAGS) DEV_CXXFLAGS= $(DEV_CFLAGS)
flash_size=128k flash_size=128k
bootldr_size=0x0 bootldr_size=0x0
endif endif # ALL_PINECIL_V2_MODELS
INCLUDES = -I$(APP_INC_DIR) \ INCLUDES=-I$(APP_INC_DIR) \
-I$(BRIEFLZ_INC_DIR) \ -I$(BRIEFLZ_INC_DIR) \
-I$(FRTOS_CMIS_INC_DIR) \ -I$(FRTOS_CMIS_INC_DIR) \
-I$(FRTOS_INC_DIR) \ -I$(FRTOS_INC_DIR) \
@@ -425,44 +493,65 @@ INCLUDES = -I$(APP_INC_DIR) \
-I$(INC_PD_DRIVERS_DIR) \ -I$(INC_PD_DRIVERS_DIR) \
$(DEVICE_INCLUDES) $(DEVICE_INCLUDES)
EXCLUDED_DIRS := -path $(PINECILV2_VENDOR_BSP_ES8388_DIR) \ EXCLUDED_DIRS:=-path $(PINECILV2_VENDOR_BSP_ES8388_DIR) \
-o -path $(PINECILV2_VENDOR_BSP_IMAGE_SENSOR_DIR) \ -o -path $(PINECILV2_VENDOR_BSP_IMAGE_SENSOR_DIR) \
-o -path $(PINECILV2_VENDOR_BSP_LVGL_DIR) \ -o -path $(PINECILV2_VENDOR_BSP_LVGL_DIR) \
-o -path $(PINECILV2_VENDOR_BSP_MCU_LCD_DIR) \ -o -path $(PINECILV2_VENDOR_BSP_MCU_LCD_DIR) \
-o -path $(PINECILV2_VENDOR_BSP_BOARD_DIR) \ -o -path $(PINECILV2_VENDOR_BSP_BOARD_DIR) \
-o -path $(PINECILV2_VENDOR_BSP_USB_DIR) \ -o -path $(PINECILV2_VENDOR_BSP_USB_DIR)
SOURCE:=$(shell find $(SOURCE_THREADS_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_CORE_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.c') \
$(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.c') \
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.c') \
$(SOURCE_BRIEFLZ_DIR)/depack.c
SOURCE := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_CORE_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.c') \
$(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.c')\
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.c') \
$(SOURCE_BRIEFLZ_DIR)/depack.c
# We exclude the USB-PD stack tests $(PD_DRIVER_TESTS_DIR) # We exclude the USB-PD stack tests $(PD_DRIVER_TESTS_DIR)
SOURCE_CPP := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.cpp') \ SOURCE_CPP:=$(shell find $(SOURCE_THREADS_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_CORE_DIR) -type f -name '*.cpp') \ $(shell find $(SOURCE_CORE_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_DRIVERS_DIR) -path $(PD_DRIVER_TESTS_DIR) -prune -false -o -type f -name '*.cpp') \ $(shell find $(SOURCE_DRIVERS_DIR) -path $(PD_DRIVER_TESTS_DIR) -prune -false -o -type f -name '*.cpp') \
$(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.cpp') \ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o -type f -name '*.cpp') \
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp') $(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
# code optimisation ------------------------------------------------------------ # Code optimisation ------------------------------------------------------------
OPTIM=-Os -fno-jump-tables -foptimize-strlen -faggressive-loop-optimizations -fdevirtualize-at-ltrans -fmerge-all-constants -fshort-wchar -flto -finline-small-functions -finline-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common -fno-math-errno -ffast-math -ffinite-math-only -fno-signed-zeros -fsingle-precision-constant OPTIM=-Os \
-fno-jump-tables \
-foptimize-strlen \
-faggressive-loop-optimizations \
-fdevirtualize-at-ltrans \
-fmerge-all-constants \
-fshort-wchar \
-flto \
-finline-small-functions \
-finline-functions \
-findirect-inlining \
-fdiagnostics-color \
-ffunction-sections \
-fdata-sections \
-fshort-enums \
-fsingle-precision-constant \
-fno-common \
-fno-math-errno \
-ffast-math \
-ffinite-math-only \
-fno-signed-zeros \
-fsingle-precision-constant
# global defines --------------------------------------------------------------- # Global defines ---------------------------------------------------------------
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar GLOBAL_DEFINES+=$(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -fshort-wchar
ifdef swd_enable ifdef swd_enable
GLOBAL_DEFINES += -DSWD_ENABLE GLOBAL_DEFINES+=-DSWD_ENABLE
endif endif
# Libs -------------------------------------------------------------------------
# libs -------------------------------------------------------------------------
LIBS= LIBS=
# ------------------------------------------------------------------------------ # Compilers --------------------------------------------------------------------
COMPILER=gcc COMPILER=gcc
# arm-none-eabi is the general ARM compiler,
# arm-none-eabi is the general ARM compiler
# riscv-none-embed is the riscv compiler # riscv-none-embed is the riscv compiler
# riscv-nuclei-elf is the nuclei tuned one for their cores # riscv-nuclei-elf is the nuclei tuned one for their cores
ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS) $(ALL_MHP30_MODELS))) ifeq ($(model),$(filter $(model),$(ALL_MINIWARE_MODELS) $(ALL_MHP30_MODELS)))
@@ -475,17 +564,18 @@ ifeq ($(model),$(filter $(model),$(ALL_PINECIL_MODELS) $(ALL_PINECIL_V2_MODELS))
COMPILER_PREFIX=riscv-none-elf COMPILER_PREFIX=riscv-none-elf
endif endif
# programs --------------------------------------------------------------------- # Programs ---------------------------------------------------------------------
CC=$(COMPILER_PREFIX)-gcc CC=$(COMPILER_PREFIX)-gcc
CPP=$(COMPILER_PREFIX)-g++ CPP=$(COMPILER_PREFIX)-g++
OBJCOPY=$(COMPILER_PREFIX)-objcopy OBJCOPY=$(COMPILER_PREFIX)-objcopy
SIZE=$(COMPILER_PREFIX)-size SIZE=$(COMPILER_PREFIX)-size
OBJDUMP=$(COMPILER_PREFIX)-objdump OBJDUMP=$(COMPILER_PREFIX)-objdump
# use gcc in assembler mode so we can use defines etc in assembly
# Use gcc in assembler mode so we can use defines etc in assembly
AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp AS=$(COMPILER_PREFIX)-gcc -x assembler-with-cpp
# linker flags ----------------------------------------------------------------- # Linker flags -----------------------------------------------------------------
LINKER_FLAGS= -Wl,--gc-sections \ LINKER_FLAGS=-Wl,--gc-sections \
-Wl,--wrap=malloc \ -Wl,--wrap=malloc \
-Wl,--wrap=free \ -Wl,--wrap=free \
-Wl,--undefined=vTaskSwitchContext \ -Wl,--undefined=vTaskSwitchContext \
@@ -497,9 +587,7 @@ LINKER_FLAGS= -Wl,--gc-sections \
--specs=nano.specs \ --specs=nano.specs \
$(DEV_LDFLAGS) $(DEV_LDFLAGS)
# compiler flags --------------------------------------------------------------- # Compiler flags ---------------------------------------------------------------
CHECKOPTIONS=-Wtrigraphs \ CHECKOPTIONS=-Wtrigraphs \
-Wuninitialized \ -Wuninitialized \
-Wmissing-braces \ -Wmissing-braces \
@@ -523,11 +611,7 @@ CHECKOPTIONS=-Wtrigraphs \
-Wno-unused-parameter \ -Wno-unused-parameter \
-Wdouble-promotion -Wdouble-promotion
CHECKOPTIONS_C=$(CHECKOPTIONS) -Wbad-function-cast
CHECKOPTIONS_C= $(CHECKOPTIONS) -Wbad-function-cast
CXXFLAGS=$(DEV_CXXFLAGS) \ CXXFLAGS=$(DEV_CXXFLAGS) \
$(CPUFLAGS) \ $(CPUFLAGS) \
@@ -546,7 +630,6 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
-fno-threadsafe-statics \ -fno-threadsafe-statics \
-T$(LDSCRIPT) -T$(LDSCRIPT)
CFLAGS=$(DEV_CFLAGS) \ CFLAGS=$(DEV_CFLAGS) \
$(CPUFLAGS) \ $(CPUFLAGS) \
$(INCLUDES) \ $(INCLUDES) \
@@ -559,51 +642,39 @@ CFLAGS=$(DEV_CFLAGS) \
-T$(LDSCRIPT) \ -T$(LDSCRIPT) \
-c -c
AFLAGS=$(CPUFLAGS) \
AFLAGS= $(CPUFLAGS) \
$(DEV_AFLAGS) \ $(DEV_AFLAGS) \
$(GLOBAL_DEFINES) \ $(GLOBAL_DEFINES) \
$(OPTIM) \ $(OPTIM) \
$(ASM_INC) \ $(ASM_INC) \
$(INCLUDES) $(INCLUDES)
OBJS=$(SOURCE:.c=.o)
OBJS_CPP=$(SOURCE_CPP:.cpp=.o)
OBJS_S=$(S_SRCS:.S=.o)
OBJS = $(SOURCE:.c=.o)
OBJS_CPP = $(SOURCE_CPP:.cpp=.o)
OBJS_S = $(S_SRCS:.S=.o)
OUT_OBJS=$(addprefix $(OUTPUT_DIR)/,$(OBJS)) OUT_OBJS=$(addprefix $(OUTPUT_DIR)/,$(OBJS))
OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP)) OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP))
OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S)) OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S))
default: firmware-EN
default : firmware-EN
firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu
@true @true
# Targets for binary files
# %.hex: %.elf Makefile
# The rule to create the target directory
#
# Create hexfile
%.hex : %.elf Makefile
$(OBJCOPY) $< -O ihex $@ $(OBJCOPY) $< -O ihex $@
%.bin : %.elf Makefile %.bin: %.elf Makefile
$(OBJCOPY) $< -O binary $@ $(OBJCOPY) $< -O binary $@
$(SIZE) $< $(SIZE) $<
%.dfu : %.bin Makefile %.dfu: %.bin Makefile
$(HOST_PYTHON) dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@ $(HOST_PYTHON) dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
$(HEXFILE_DIR)/$(model)_%.elf : \ $(HEXFILE_DIR)/$(model)_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation.%.o \ $(OUTPUT_DIR)/Core/Gen/Translation.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
@@ -615,7 +686,7 @@ $(HEXFILE_DIR)/$(model)_%.elf : \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map $(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(HEXFILE_DIR)/$(model)_string_compressed_%.elf : \ $(HEXFILE_DIR)/$(model)_string_compressed_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \ $(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
@@ -627,7 +698,7 @@ $(HEXFILE_DIR)/$(model)_string_compressed_%.elf : \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map $(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \ $(HEXFILE_DIR)/$(model)_font_compressed_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \ $(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
@@ -639,11 +710,11 @@ $(HEXFILE_DIR)/$(model)_font_compressed_%.elf : \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map $(LIBS) $(LINKER_FLAGS) -o$@ -Wl,-Map=$@.map
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile $(OUT_OBJS): $(OUTPUT_DIR)/%.o: %.c Makefile
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $< -o $@ @$(CC) -c $(CFLAGS) $< -o $@
$(OUTPUT_DIR)/%.o : %.cpp Makefile $(OUTPUT_DIR)/%.o: %.cpp Makefile
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@$(CPP) -c $(CXXFLAGS) $< -o $@ @$(CPP) -c $(CXXFLAGS) $< -o $@
@@ -671,10 +742,7 @@ Core/Gen/macros.txt: Makefile
@test -d $(CURDIR)/Core/Gen || mkdir -p $(CURDIR)/Core/Gen @test -d $(CURDIR)/Core/Gen || mkdir -p $(CURDIR)/Core/Gen
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF $(CURDIR)/Core/Gen/macros.tmp - > $(CURDIR)/Core/Gen/macros.txt echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF $(CURDIR)/Core/Gen/macros.tmp - > $(CURDIR)/Core/Gen/macros.txt
# The recipes to produce compressed translation data
#
# The recipes to produce compressed translation data:
#
$(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp
@test -d $(@D) || mkdir -p $(@D) @test -d $(@D) || mkdir -p $(@D)
@@ -711,14 +779,12 @@ Core/Gen/Translation_brieflz_font.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.file
--compress-font \ --compress-font \
$* $*
#
# The recipes to produce multi-language firmwares: # The recipes to produce multi-language firmwares:
#
# Usage: $(eval $(call multi_lang_rule,$(1)=group_code,$(2)=group_name,$(3)=lang_codes)) # Usage: $(eval $(call multi_lang_rule,$(1)=group_code,$(2)=group_name,$(3)=lang_codes))
define multi_lang_rule define multi_lang_rule
$(HEXFILE_DIR)/$(model)_multi_$(2).elf : \ $(HEXFILE_DIR)/$(model)_multi_$(2).elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \ $(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
@@ -730,7 +796,7 @@ $(HEXFILE_DIR)/$(model)_multi_$(2).elf : \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,-Map=$$@.map $(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,-Map=$$@.map
$(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf : \ $(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \ $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \ $(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \ $(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
@@ -772,10 +838,10 @@ Core/Gen/Translation_brieflz_multi.$(1).cpp: $(OUTPUT_DIR)/Core/Gen/translation.
endef # multi_lang_rule endef # multi_lang_rule
# Add multi-language firmware rules: # Add multi-language firmware rules:
$(foreach group_code,$(LANGUAGE_GROUPS),$(eval $(call multi_lang_rule,$(group_code),$(LANGUAGE_GROUP_$(group_code)_NAME),$(LANGUAGE_GROUP_$(group_code)_LANGS)))) $(foreach group_code,$(LANGUAGE_GROUPS),$(eval $(call multi_lang_rule,$(group_code),$(LANGUAGE_GROUP_$(group_code)_NAME),$(LANGUAGE_GROUP_$(group_code)_LANGS))))
# Clean up targets
clean: clean:
rm -Rf Core/Gen rm -Rf Core/Gen
@@ -786,28 +852,55 @@ clean:
clean-all: clean clean-all: clean
rm -Rf $(HEXFILE_DIR) rm -Rf $(HEXFILE_DIR)
style: # Code style checks using clang-format
@for src in $(ALL_SOURCE) $(ALL_INCLUDES); do \
echo "Formatting $$src..." ; \
clang-format -i "$$src" ; \
done
@echo "Done"
check-style: # Show only list of affected files for debug purposes
@for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \ check-style-list:
@ret=0; for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \ var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
if [ $$var -ne 0 ] ; then \ if [ $$var -ne 0 ] ; then \
echo "$$src does not respect the coding style (diff: $$var lines)" ; \ echo "$$src" ; \
clang-format "$$src" | diff "$$src" -; \ ret=1; test -n "$(STOP)" && break; \
exit 1 ; \
fi ; \ fi ; \
done grep -H -n -e "^ .*if .*)$$" -e "^ .*else$$" -e "^ .* do$$" -e "^ .*while .*)$$" -e "^ .*for .*)$$" "$$src" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -q -e "^.*$$" ; \
@echo "Style check passed" if [ "$$?" -ne 1 ]; then \
echo "$$src" ; \
ret=1; test -n "$(STOP)" && break; \
fi ; \
done ; \
if [ $$ret -eq 0 ] ; then \
echo "Style check: PASS" && exit 0 ; \
else \
echo "Style check: FAIL!" && echo "Please, check the log above for the details." && exit 1 ; \
fi ;
.PHONY: style all clean default clean-all # Show output in gcc-like error compatible format for IDEs/editors; call `make check-style STOP=1` to exit after first failed file
# NOTICE:
# - clang-format has neat option for { } in condition blocks but it's available only since version 15:
# * https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces
# - grep block in the middle used to trace missing { and } for if/else BUT IT'S VERY SPECULATIVE, very-very hacky & dirty
check-style:
@ret=0; for src in $(ALL_SOURCE) $(ALL_INCLUDES) ; do \
var=`clang-format "$$src" | diff "$$src" - | wc -l` ; \
if [ $$var -ne 0 ] ; then \
clang-format "$$src" | diff "$$src" - | sed 's/^---/-------------------------------------------------------------------------------/; s/^< /--- /; s/^> /+++ /; /^[0-9].*/ s/[acd,].*$$/ERROR1/; /^[0-9].*/ s,^,\n\n\n\n'"$$src"':,; /ERROR1$$/ s,ERROR1$$,:1: error: clang-format code style mismatch:,; ' ; \
ret=1; test -n "$(STOP)" && break; \
fi ; \
grep -H -n -e "^ .*if .*)$$" -e "^ .*else$$" -e "^ .* do$$" -e "^ .*while .*)$$" -e "^ .*for .*)$$" "$$src" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -e "^.*$$" ; \
if [ "$$?" -ne 1 ]; then \
ret=1; test -n "$(STOP)" && break; \
fi ; \
done ; \
if [ $$ret -eq 0 ] ; then \
echo "Style check: PASS" && exit 0 ; \
else \
echo "Style check: FAIL!" && echo "Please, check the log above for the details." && exit 1 ; \
fi ;
.PHONY: check-style-list check-style all clean default clean-all
.SECONDARY: .SECONDARY:
# pull in dependency info for *existing* .o files # Pull in dependency info for *existing* .o files
-include $(OUT_OBJS:.o=.d) -include $(OUT_OBJS:.o=.d)
-include $(OUT_OBJS_CPP:.o=.d) -include $(OUT_OBJS_CPP:.o=.d)
-include $(OUTPUT_DIR)/Core/Gen/Translation.*.d -include $(OUTPUT_DIR)/Core/Gen/Translation.*.d

View File

@@ -1,7 +1,24 @@
/** /**
* Firmware build version - format: xx.yy.zzzzzz * Firmware build version - format: xx.yy+[.zzzzzzzz]
* x: Major - y: Minor - z: git short hash generated automaticaly from git *
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4' * x: major version
* y: minor version
* +: build type:
* * R - git-related release tag vXX.YY
* * T - git-related release tag but version is not vXX.YY !
* * D - git-related dev branch
* * B - git-related custom branch
* * G - neither above but git-related
* * H - build outside of a git tree (i.e. release tarball)
* * S - something special (should not happen?)
* * V - something very special (should not happen!)
* z: short commit ID hash generated automaticaly from git
* * (for git-related build types only)
*
* i.e.:
* * BUILD_VERSION = 'v2.22' -> from tarball: 'v2.22H'
* * BUILD_VERSION = 'v2.22' -> from git dev branch: 'v2.22D.1A2B3C4D'
* * BUILD_VERSION = 'v2.22' -> from stable git release: 'v2.22R.5E6F7G8H'
*/ */
#define BUILD_VERSION "v2.21" #define BUILD_VERSION "v2.22"