The documentation, CAN doc file, and firmware all indicate that the current state is only one byte of the heartbeat message. This file used to read four bytes as the state on line 21, but only one byte on line 49. This PR adjusts line 21 so that it only uses one byte, making this example work. Otherwise, it incorrectly reads the flags that occupy the next three bytes as part of the state, which can cause the idle state to never be recognized.
Since c5720564 (Force version to be regenerated on each compile,
2021-06-01) `autogen/version.c` must be generated during the build
process, but the build instructions in the `Dockerfile` have not been
updated accordingly. Since then two commits [1] on separate branches
updated `Dockerfile` to deal with the missing file, and now
`autogen/version.c` is generated twice during a containerized build.
Remove all redundant commands from `Dockerfile`'s `CMD` instruction to
generate `autogen/version.c` and its subdirectory only once.
[1] 8e9745a6 (Add version.c generation to dockerbuild and actions,
2021-11-02)
7f013d6d (Fixed dockerbuild.sh, now run as user (instead
of root) and fixed the autogeneration of version.c,
2021-09-16)
The `Dockerfile` uses separate `RUN` instructions for each `apt-get`
command. Docker's documentation considers this as an anti-pattern,
because it can lead to caching issues [1].
Follow Docker's advice, and combine all `apt-get` invocations into a
single `RUN` instruction with an &&-chaned list of commands. This
makes it rather hard to tell which command produces which output, so
insert a `set -x` at the beginning of the command chain to generate a
trace of the executed commands.
[1] Each `RUN` instruction, including subsequent `RUN apt-get update`
and `RUN apt-get install` instructions create separate layers that
are stored in the Docker cache. If someone were to modify the
list of list of packages to install, then Docker would re-use the
layer created by the prior `RUN apt-get update` instruction,
meaning that `apt-get install` would use an outdate package list.
This can lead to outdated packages to be installed, or a failure
if the outdated version is not present anymore in the package
repository.
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run