diff options
| author | Selene ToyKeeper | 2023-12-05 16:49:24 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-12-05 16:49:24 -0700 |
| commit | 50ae5684534ec9333a648794d4f371b882e53075 (patch) | |
| tree | e666fea7d540632dc99643468184b519e647c12d | |
| parent | d3aa: made it easy to switch between vddio2 and external voltage divider (diff) | |
| parent | moved version string calculation to bin/version-string.sh (diff) | |
| download | anduril-50ae5684534ec9333a648794d4f371b882e53075.tar.gz anduril-50ae5684534ec9333a648794d4f371b882e53075.tar.bz2 anduril-50ae5684534ec9333a648794d4f371b882e53075.zip | |
Merge branch 'trunk' into emisar-d3aa
* trunk:
moved version string calculation to bin/version-string.sh
forgot one item in the ChangeLog
ChangeLog: added 2023-12-03 release notes, converted @modelname to &modelname
docs: expanded / reorganized info on Version Check formats
updated MODELS, bin/models.py, and hw/BRANDS...
fw3x: document how it ships with the wrong fuse values, and how to fix it
github CI: fetch history too, to allow detection of version tags
build-all: handle the case where "git describe" can't get any tags
run CI on all branches, not just on trunk
fetch tags on CI checkout, so 'git describe' can work
added docs/battery-rainbow.png from old repo, since it's still relevant
added bin/make-release.sh to generate a .zip file ready for release
build-all.sh: re-indented, started organizing code into functions
changed version number to use the latest release tag instead of build date
| -rw-r--r-- | .github/workflows/compile.yml | 15 | ||||
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | ChangeLog.md | 169 | ||||
| -rw-r--r-- | MODELS | 154 | ||||
| -rwxr-xr-x | bin/build-all.sh | 140 | ||||
| -rwxr-xr-x | bin/build.sh | 2 | ||||
| -rwxr-xr-x | bin/make-release.sh | 55 | ||||
| -rwxr-xr-x | bin/models.py | 33 | ||||
| -rwxr-xr-x | bin/version-string.sh | 58 | ||||
| -rw-r--r-- | docs/anduril-manual.md | 65 | ||||
| -rw-r--r-- | docs/battery-rainbow.png | bin | 0 -> 2920 bytes | |||
| -rw-r--r-- | docs/which-hex-file.md | 42 | ||||
| -rw-r--r-- | hw/BRANDS | 6 | ||||
| -rw-r--r-- | hw/lumintop/fw3x-lume1/README.md | 5 | ||||
| -rwxr-xr-x | make | 6 |
15 files changed, 506 insertions, 246 deletions
diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 893eb41..2ba771f 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -1,10 +1,13 @@ name: build all on: - push: - branches: [ "trunk" ] - pull_request: - branches: [ "trunk" ] + # all branches: + [ push, pull_request ] + # trunk only: + #push: + # branches: [ "trunk" ] + #pull_request: + # branches: [ "trunk" ] jobs: compile: @@ -14,6 +17,10 @@ jobs: - name: Checkout uses: actions/checkout@master + # allow 'git describe' to work, by fetching tags and history + with: + fetch-depth: 0 + fetch-tags: true - name: Stop committing version.h # reject commit if version.h was changed @@ -1,3 +1,4 @@ +.build/ .env/ .venv/ .*.swo @@ -7,6 +8,7 @@ env/ hex/ ignore/ old/ +releases/ venv/ *~ *.cpp diff --git a/ChangeLog.md b/ChangeLog.md index 0aaa392..a70a398 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,10 +10,75 @@ formats: - Removed - Changed - Documented - - @brand-model: Hardware-specific change (NNNN, NNNN, ...) + - &brand-model: Hardware-specific change (NNNN, NNNN, ...) # Next +# 2023-12-03 + +This release is somewhat higher risk than usual, because so many large things +changed deep in the code. I did major restructuring and refactoring across the +entire project. It should work fine, but be on the lookout for any weird +problems. + +General: + +- Moved from Bzr + Launchpad to **Git + GitHub**, by popular request. +- **Completely reorganized the project** files. Really, a *massive* amount of + restructuring. The flashlight end-user interface is still the same, but + expect to have to learn the code layout from scratch. Read the [README.md] + for info about getting started with the new project layout. +- Added support for AVR DD MCUs like **avr32dd20**. This is the recommended + MCU to use in new flashlights. +- Added ability to use turbo in momentary mode. +- Upgraded **battery voltage resolution** from 0.1V steps to **0.025V** steps. + Battery check has an extra digit which can be 0, 2, 5, or 7 (for example, for + 3.70V, 3.725V, .3.75V, and 3.775V). +- Made Battery Check more consistent, so it's less likely to give different + values on the 1st and 2nd readout. +- Re-calibrated timing on each MCU type, so a 1-second beacon flasher should be + closer to 1 actual second now... mostly. Timing still varies significantly + from one light to another. +- Fixed default bike flasher brightness on some builds. It was sometimes way + too high. +- Fixed RGB aux turning on during momentary mode sometimes. +- Converted documentation to markdown format, and rewrote a lot of it. +- Fixed some build issues with specific compile-time options. +- Changed the format of **version numbers**. It now uses the most recent + release tag instead of the build date, and **may have additional numbers at + the end** to indicate distance from the last official release, and whether + the repo was clean or dirty. Today's release is `MODEL-2023-12-03`. A + derivative built 52 commits later in a dirty repo would look like + `MODEL-2023-12-03-52-1`. + +New lights: + +- Added &thefreeman-avr32dd20-devkit. It's only used for development purposes, + but otherwise it's pretty neat. It'll be the basis for many new lights in + the future. (model 1632dd20) + +Hardware-specific changes: + +- Improved idle efficiency on attiny1616, which was spending entirely too much + time doing math it didn't actually need. +- &hank-\*-boost: Fixed flicker while holding button at moon level. Reduced + ripple on low modes. (0216, 0253, 0273) +- &lumintop-blf-gt: Added smooth steps. Removed a couple other things to make + room. (0321) +- &lumintop-fw3x: Multiple fixes and upgrades... (0314, 0315) + - Fixed thermal regulation. Also fixed the external temperature sensor. + - Made moon much lower, and made ramp much smoother, by upgrading to DSM. + - Fixed the aux RGB pinouts because Lumintop got the wiring backward. + - Added a second build target for people who fixed the wires manually. + - Added red/blue police color strobe. + - Made low modes more efficient with underclocking. Moon should run at least + 4X as long as it did before. + - Fixed party strobe being blurry. + - Added documentation for the FW3X's multiple, uh, quirks. +- &sofirn-lt1s-pro: Disabled manual memory, memory timer, and extended simple + UI by default. Simple mode is simpler, and the factory settings should be + more consistent with other lights now. (0623) + # 2023-10-31 General: @@ -37,30 +102,30 @@ General: New lights: -- @thefreeman-boost21-6a: Added. (1631) +- &thefreeman-boost21-6a: Added. (1631) (very nice HDR boost driver which fits into a FW3A) -- @thefreeman-boost-fwaa: Added. (1632) +- &thefreeman-boost-fwaa: Added. (1632) (very nice AA/li-ion HDR boost driver which fits into a FWAA) Hardware-specific changes: - Upgraded several builds to use delta-sigma modulation (DSM), for lower lows and smoother ramping with less flicker or ripple: - - @blf-lt1 (0621) - - @blf-lt1-t1616 (0622) - - @emisar-d4k-3ch (0151) + - &blf-lt1 (0621) + - &blf-lt1-t1616 (0622) + - &emisar-d4k-3ch (0151) (**dramatically** improves resolution and low modes on its 8-bit channel) - - @noctigon-dm11-boost (0273) - - @noctigon-kr4-boost (0216) - - @noctigon-k1-boost (0253) - - @noctigon-m44 (0143) + - &noctigon-dm11-boost (0273) + - &noctigon-kr4-boost (0216) + - &noctigon-k1-boost (0253) + - &noctigon-m44 (0143) - Upgraded some builds to use dynamic PWM, for lower lows and smoother ramping: - - @blf-q8-t1616, @sofirn-sp36-t1616 (0613, 0614) - - @gchart-fet1-t1616 (1618) - - @noctigon-k1-sbt90 (0252) + - &blf-q8-t1616, &sofirn-sp36-t1616 (0613, 0614) + - &gchart-fet1-t1616 (1618) + - &noctigon-k1-sbt90 (0252) -- @wurkkos-ts10, @wurkkos-ts10-rgbaux: Fixed too-high default ceiling. (0713, 0714) +- &wurkkos-ts10, &wurkkos-ts10-rgbaux: Fixed too-high default ceiling. (0713, 0714) # 2023-10-01 @@ -75,42 +140,42 @@ General: - Fixed some minor post-off voltage display bugs. - Made RGB button brightness update faster in blinky modes. - Fixed bug: Wrong channel after colored factory reset. -- @attiny1616, @attiny1634: Partially fixed oscillating aux LED voltage +- &attiny1616, &attiny1634: Partially fixed oscillating aux LED voltage colors while off. Better than before, but can still happen in some cases. -- @attiny1616: Fixed spurious voltage warnings in sleep mode. (it could +- &attiny1616: Fixed spurious voltage warnings in sleep mode. (it could sometimes go from Lockout mode to Off mode by itself) - Lots of internal refactoring. New lights: -- @emisar-2ch-fet: Added. (0136) -- @emisar-d4k-3ch: Added. (0151) -- @noctigon-m44: Added. (0143) -- @wurkkos-ts10-rgbaux: Added. (0713) +- &emisar-2ch-fet: Added. (0136) +- &emisar-d4k-3ch: Added. (0151) +- &noctigon-m44: Added. (0143) +- &wurkkos-ts10-rgbaux: Added. (0713) Hardware-specific changes: -- @ff-e01, @ff-pl47, @ff-pl47g2: Enabled smooth steps instead of SOS mode. +- &ff-e01, &ff-pl47, &ff-pl47g2: Enabled smooth steps instead of SOS mode. (0421, 0422, 0423, 0441) -- @emisar-2ch, @noctigon-m44: Added RGB aux channel modes. (0135, 0143) -- @emisar-2ch-fet, @noctigon-k9.3: New ramps with better-calibrated shape. +- &emisar-2ch, &noctigon-m44: Added RGB aux channel modes. (0135, 0143) +- &emisar-2ch-fet, &noctigon-k9.3: New ramps with better-calibrated shape. (0136, 0261) -- @emisar-d4v2-nofet: New ramp table. (0115) -- @emisar-d4sv2-tintramp: Removed / renamed. (0135, 0136) -- @noctigon-k9.3: Fixed years-old mess. Merged builds, converted to +- &emisar-d4v2-nofet: New ramp table. (0115) +- &emisar-d4sv2-tintramp: Removed / renamed. (0135, 0136) +- &noctigon-k9.3: Fixed years-old mess. Merged builds, converted to multi-channel, removed old builds, generally got K9.3 working quite a bit better. (0261, 0262, 0263, 0265, 0266, 0267) -- @noctigon-m44: Lower moon, and greatly reduced flicker. (0143) -- @sofirn-lt1s-pro: Allow configuring the blink channel. (0623) -- @wurkkos: Raised default temperature limit to 50 C. (07xx) -- @wurkkos-ts10: Better / smoother ramp. (0713, 0714) +- &noctigon-m44: Lower moon, and greatly reduced flicker. (0143) +- &sofirn-lt1s-pro: Allow configuring the blink channel. (0623) +- &wurkkos: Raised default temperature limit to 50 C. (07xx) +- &wurkkos-ts10: Better / smoother ramp. (0713, 0714) # 2023-06-29 - Fixed red aux blink on 1st frame of post-off voltage display - Removed Harry Potter references because its author (J.K. Rowling) spreads hate -- @noctigon-kr4: Fixed thermal regulation (0211, 0212, 0213, 0214, 0215, 0216) +- &noctigon-kr4: Fixed thermal regulation (0211, 0212, 0213, 0214, 0215, 0216) # 2023-05-30 @@ -126,18 +191,18 @@ Hardware-specific changes: help ensure it works on all lights. - Minor code changes with no runtime impact - Documented new version check format -- @wurkkos: Added red+blue police strobe (0715, 0716, 0717) -- @noctigon-kr4: Broke thermal regulation (oops) (0211, 0212, 0213, 0214, +- &wurkkos: Added red+blue police strobe (0715, 0716, 0717) +- &noctigon-kr4: Broke thermal regulation (oops) (0211, 0212, 0213, 0214, 0215, 0216) -- @noctigon-kr4: Use 7 aux channel modes instead of 3 (0211, 0212, 0213, 0214, +- &noctigon-kr4: Use 7 aux channel modes instead of 3 (0211, 0212, 0213, 0214, 0215, 0216) -- @emisar-d4v2: Changed number blinks from aux to main LEDs by default (0113, +- &emisar-d4v2: Changed number blinks from aux to main LEDs by default (0113, 0114, 0115, 0123) # 2023-05-17 -- @noctigon-dm11-12v: Renamed to noctigon-dm11-boost (0273) -- @noctigon-dm11-boost: Now supported in multi-channel branch (0273) +- &noctigon-dm11-12v: Renamed to noctigon-dm11-boost (0273) +- &noctigon-dm11-boost: Now supported in multi-channel branch (0273) # 2023-05-02 @@ -160,14 +225,14 @@ Hardware-specific changes: it to the value it saved, which was wrong) - Documented ramp 6C, ramp 4C, ramp 4H, lockout 3H, battcheck 3C, and post-off voltage display config -- @emisar-d4v2: Added the rest of the aux RGB colors as channel modes, and set +- &emisar-d4v2: Added the rest of the aux RGB colors as channel modes, and set aux "white" as the mode it uses to blink out numbers (0113, 0114, 0115, 0123) -- @wurkkos-ts10: Converted to multi-channel, and gave it a new ramp with +- &wurkkos-ts10: Converted to multi-channel, and gave it a new ramp with better low modes (0714) -- @wurkkos-ts25: Converted to multi-channel, and gave it a smoother ramp +- &wurkkos-ts25: Converted to multi-channel, and gave it a smoother ramp (0715) -- @wurkkos: Added Wurkkos FC13 and TS11 (0716, 0717) +- &wurkkos: Added Wurkkos FC13 and TS11 (0716, 0717) # 2023-04-29 @@ -178,13 +243,13 @@ Hardware-specific changes: - Made 3H+ use mem level instead of lowest moon (this is needed for making the channel discernible, and also helps make aux LED controls stand out more) -- @emisar, @noctigon: Added Extended Simple UI to Hank's config, so a few more +- &emisar, &noctigon: Added Extended Simple UI to Hank's config, so a few more features are allowed in simple mode -- @emisar-d4v2, @noctigon-kr4: Slightly smaller ROM size -- @emisar-d4sv2: Converted to multi-channel, and updated it to use dynamic PWM +- &emisar-d4v2, &noctigon-kr4: Slightly smaller ROM size +- &emisar-d4sv2: Converted to multi-channel, and updated it to use dynamic PWM for a smoother ramp with lower lows (0133, 0134) -- @noctigon-kr4: Converted to multi-channel (0211, 0212, 0213, 0214) -- @noctigon-kr4: Don't blink at top of regulated power (0211, 0213, 0214) +- &noctigon-kr4: Converted to multi-channel (0211, 0212, 0213, 0214) +- &noctigon-kr4: Don't blink at top of regulated power (0211, 0213, 0214) # 2023-04-28 @@ -196,8 +261,8 @@ Hardware-specific changes: default) - Changed tactical mode default config: only use 2-color strobe if it's on main LEDs, not aux LEDs -- @emisar-d4v2: Smoother ramp (0113, 0114) -- @emisar-d4v2: Added hidden channel modes for RGB aux LEDs (0113, 0114, 0115) +- &emisar-d4v2: Smoother ramp (0113, 0114) +- &emisar-d4v2: Added hidden channel modes for RGB aux LEDs (0113, 0114, 0115) # 2023-04-27 @@ -207,7 +272,7 @@ Hardware-specific changes: - Fixed unnecessary flickering when changing channel modes from/to the same value - Fixed sleep voltage measurement on attiny1616 -- @noctigon-kr4-tintramp: Converted to multi-channel, renamed to +- &noctigon-kr4-tintramp: Converted to multi-channel, renamed to noctigon-kr4-2ch (0215) # 2023-04-25 @@ -226,15 +291,15 @@ Hardware-specific changes: (this change was obsoleted soon by a better post-off voltage display) - Broke sleep voltage measurement on attiny1616 (oops) - Changed internal details for how gradual ramping works -- @emisar-d4sv2-tintramp: Converted to multi-channel, renamed to emisar-2ch. +- &emisar-d4sv2-tintramp: Converted to multi-channel, renamed to emisar-2ch. (0135) -- @sofirn-lt1s-pro: Updated to use today's new code internals (0623) +- &sofirn-lt1s-pro: Updated to use today's new code internals (0623) # 2023-04-19 - Added stepped tint ramping - Documented new channel modes system -- @sofirn-lt1s-pro: Added white-only auto-tint mode (0623) +- &sofirn-lt1s-pro: Added white-only auto-tint mode (0623) # Older: TODO @@ -1,80 +1,82 @@ -Models: 70 +Models: 72 -Model Name MCU ------ ---- --- -0111 hank-emisar-d4 attiny85 -0112 hank-emisar-d4-219 attiny85 -0113 hank-emisar-d4v2 attiny1634 -0114 hank-emisar-d4v2-219 attiny1634 -0115 hank-emisar-d4v2-nofet attiny1634 -0121 hank-emisar-d1 attiny85 -0122 hank-emisar-d1s attiny85 -0123 hank-emisar-d1v2-7135-fet attiny1634 -0124 hank-emisar-d1v2-linear-fet attiny1634 -0125 hank-emisar-d1v2-nofet attiny1634 -0131 hank-emisar-d4s attiny85 -0132 hank-emisar-d4s-219 attiny85 -0133 hank-emisar-d4sv2 attiny1634 -0134 hank-emisar-d4sv2-219 attiny1634 -0135 hank-emisar-2ch attiny1634 -0136 hank-emisar-2ch-fet attiny1634 -0141 hank-emisar-d18 attiny85 -0142 hank-emisar-d18-219 attiny85 -0143 hank-noctigon-m44 attiny1634 -0151 hank-emisar-d4k-3ch attiny1634 -0211 hank-noctigon-kr4 attiny1634 -0212 hank-noctigon-kr4-nofet attiny1634 -0213 hank-noctigon-kr4-219 attiny1634 -0214 hank-noctigon-kr4-219b attiny1634 -0215 hank-noctigon-kr4-2ch attiny1634 -0216 hank-noctigon-kr4-boost attiny1634 -0251 hank-noctigon-k1 attiny1634 -0252 hank-noctigon-k1-sbt90 attiny1634 -0253 hank-noctigon-k1-boost attiny1634 -0261 hank-noctigon-k9.3 attiny1634 -0262 hank-noctigon-k9.3-nofet attiny1634 -0263 hank-noctigon-k9.3-219 attiny1634 -0265 noctigon-k9.3-tintramp-nofet attiny1634 (old, use 0262) -0266 noctigon-k9.3-tintramp-fet attiny1634 (old, use 0261) -0267 noctigon-k9.3-tintramp-219 attiny1634 (old, use 0263) -0271 hank-noctigon-dm11 attiny1634 -0272 hank-noctigon-dm11-nofet attiny1634 -0273 hank-noctigon-dm11-boost attiny1634 -0274 hank-noctigon-dm11-sbt90 attiny1634 -0311 lumintop-fw3a attiny85 -0312 lumintop-fw3a-219 attiny85 -0313 lumintop-fw3a-nofet attiny85 -0314 lumintop-fw3x-lume1 attiny1634 -0321 lumintop-blf-gt attiny85 -0322 lumintop-blf-gt-mini attiny85 -0411 fireflies-rot66 attiny85 -0412 fireflies-rot66-219 attiny85 -0413 fireflies-rot66g2 attiny85 -0421 fireflies-pl47 attiny85 -0422 fireflies-pl47-219 attiny85 -0423 fireflies-pl47g2 attiny85 -0441 fireflies-e01 attiny85 -0511 mateminco-mf01s attiny85 -0521 mateminco-mf01-mini attiny85 -0531 mateminco-mt35-mini attiny85 -0611 sofirn-blf-q8 attiny85 -0612 sofirn-sp36 attiny85 -0613 sofirn-blf-q8-t1616 attiny1616 -0614 sofirn-sp36-t1616 attiny1616 -0621 sofirn-blf-lt1 attiny85 -0622 sofirn-blf-lt1-t1616 attiny1616 -0623 sofirn-lt1s-pro attiny1616 -0631 sofirn-sp10-pro attiny1616 -0632 sofirn-sc21-pro attiny1616 -0713 wurkkos-ts10-rgbaux attiny1616 -0714 wurkkos-ts10 attiny1616 -0715 wurkkos-ts25 attiny1616 -0716 wurkkos-fc13 attiny1616 -0717 wurkkos-ts11 attiny1616 -1618 gchart-fet1-t1616 attiny1616 -1630 thefreeman-lin16dac attiny1616 -1631 thefreeman-boost21-6a attiny1616 -1632 thefreeman-boost-fwaa attiny1616 +Model MCU Name +----- --- ---- +0111 attiny85 hank-emisar-d4 +0112 attiny85 hank-emisar-d4-219 +0113 attiny1634 hank-emisar-d4v2 +0114 attiny1634 hank-emisar-d4v2-219 +0115 attiny1634 hank-emisar-d4v2-nofet +0121 attiny85 hank-emisar-d1 +0122 attiny85 hank-emisar-d1s +0123 attiny1634 hank-emisar-d1v2-7135-fet +0124 attiny1634 hank-emisar-d1v2-linear-fet +0125 attiny1634 hank-emisar-d1v2-nofet +0131 attiny85 hank-emisar-d4s +0132 attiny85 hank-emisar-d4s-219 +0133 attiny1634 hank-emisar-d4sv2 +0134 attiny1634 hank-emisar-d4sv2-219 +0135 attiny1634 hank-emisar-2ch +0136 attiny1634 hank-emisar-2ch-fet +0141 attiny85 hank-emisar-d18 +0142 attiny85 hank-emisar-d18-219 +0143 attiny1634 hank-noctigon-m44 +0151 attiny1634 hank-emisar-d4k-3ch +0211 attiny1634 hank-noctigon-kr4 +0212 attiny1634 hank-noctigon-kr4-nofet +0213 attiny1634 hank-noctigon-kr4-219 +0214 attiny1634 hank-noctigon-kr4-219b +0215 attiny1634 hank-noctigon-kr4-2ch +0216 attiny1634 hank-noctigon-kr4-boost +0251 attiny1634 hank-noctigon-k1 +0252 attiny1634 hank-noctigon-k1-sbt90 +0253 attiny1634 hank-noctigon-k1-boost +0261 attiny1634 hank-noctigon-k9.3 +0262 attiny1634 hank-noctigon-k9.3-nofet +0263 attiny1634 hank-noctigon-k9.3-219 +0265 attiny1634 noctigon-k9.3-tintramp-nofet (old, use 0262) +0266 attiny1634 noctigon-k9.3-tintramp-fet (old, use 0261) +0267 attiny1634 noctigon-k9.3-tintramp-219 (old, use 0263) +0271 attiny1634 hank-noctigon-dm11 +0272 attiny1634 hank-noctigon-dm11-nofet +0273 attiny1634 hank-noctigon-dm11-boost +0274 attiny1634 hank-noctigon-dm11-sbt90 +0311 attiny85 lumintop-fw3a +0312 attiny85 lumintop-fw3a-219 +0313 attiny85 lumintop-fw3a-nofet +0314 attiny1634 lumintop-fw3x-lume1 +0315 attiny1634 lumintop-fw3x-lume1-rgbswap +0321 attiny85 lumintop-blf-gt +0322 attiny85 lumintop-blf-gt-mini +0411 attiny85 fireflies-rot66 +0412 attiny85 fireflies-rot66-219 +0413 attiny85 fireflies-rot66g2 +0421 attiny85 fireflies-pl47 +0422 attiny85 fireflies-pl47-219 +0423 attiny85 fireflies-pl47g2 +0441 attiny85 fireflies-e01 +0511 attiny85 mateminco-mf01s +0521 attiny85 mateminco-mf01-mini +0531 attiny85 mateminco-mt35-mini +0611 attiny85 sofirn-blf-q8 +0612 attiny85 sofirn-sp36 +0613 attiny1616 sofirn-blf-q8-t1616 +0614 attiny1616 sofirn-sp36-t1616 +0621 attiny85 sofirn-blf-lt1 +0622 attiny1616 sofirn-blf-lt1-t1616 +0623 attiny1616 sofirn-lt1s-pro +0631 attiny1616 sofirn-sp10-pro +0632 attiny1616 sofirn-sc21-pro +0713 attiny1616 wurkkos-ts10-rgbaux +0714 attiny1616 wurkkos-ts10 +0715 attiny1616 wurkkos-ts25 +0716 attiny1616 wurkkos-fc13 +0717 attiny1616 wurkkos-ts11 +1618 attiny1616 gchart-fet1-t1616 +1630 attiny1616 thefreeman-lin16dac +1631 attiny1616 thefreeman-boost21-mp3431-hdr-dac-argb +1632 attiny1616 thefreeman-boost-fwaa-mp3432-hdr-dac-rgb +1632dd20 avr32dd20 thefreeman-avr32dd20-devkit Duplicates: diff --git a/bin/build-all.sh b/bin/build-all.sh index df72ad5..f2420a7 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -9,68 +9,82 @@ # enable "**" for recursive glob (requires bash) shopt -s globstar -if [ "$#" -gt 0 ]; then - # multiple search terms with "AND" - SEARCH=( "$@" ) - # memes - [ "$1" = "me" ] && shift && shift && echo "Make your own $*." && exit 1 -fi - -# TODO: detect UI from $0 and/or $* -UI=anduril - -mkdir -p hex - -# TODO: use a git tag for the version, instead of build date -# TODO: use build/version.h instead of $UI/version.h ? -date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h - -PASS=0 -FAIL=0 -PASSED='' -FAILED='' - -# build targets are hw/$vendor/$model/**/$ui.h -for TARGET in hw/*/*/**/"$UI".h ; do - - # friendly name for this build - NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-'"$UI"'.h/ && print "$1\n";') - - # limit builds to searched patterns, if given - SKIP=0 - if [ ${#SEARCH[@]} -gt 0 ]; then - for text in "${SEARCH[@]}" ; do - if ! echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null ; then - SKIP=1 +function main { + + if [ "$#" -gt 0 ]; then + # multiple search terms with "AND" + SEARCH=( "$@" ) + # memes + [ "$1" = "me" ] && shift && shift && echo "Make your own $*." && exit 1 + fi + + # TODO: detect UI from $0 and/or $* + UI=anduril + + mkdir -p hex + + make-version-h # generate a version.h file + + PASS=0 + FAIL=0 + PASSED='' + FAILED='' + + # build targets are hw/$vendor/$model/**/$ui.h + for TARGET in hw/*/*/**/"$UI".h ; do + + # friendly name for this build + NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-'"$UI"'.h/ && print "$1\n";') + + # limit builds to searched patterns, if given + SKIP=0 + if [ ${#SEARCH[@]} -gt 0 ]; then + for text in "${SEARCH[@]}" ; do + if ! echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null ; then + SKIP=1 + fi + done fi + if [ 1 = $SKIP ]; then continue ; fi + + # announce what we're going to build + echo "===== $UI $REV : $NAME =====" + + # try to compile, track result, and rename compiled files + if bin/build.sh "$TARGET" ; then + HEX_OUT="hex/$UI.$NAME.hex" + mv -f "ui/$UI/$UI".hex "$HEX_OUT" + MD5=$(md5sum "$HEX_OUT" | cut -d ' ' -f 1) + echo " # $MD5" + echo " > $HEX_OUT" + PASS=$((PASS + 1)) + PASSED="$PASSED $NAME" + else + echo "ERROR: build failed" + FAIL=$((FAIL + 1)) + FAILED="$FAILED $NAME" + fi + done - fi - if [ 1 = $SKIP ]; then continue ; fi - - # announce what we're going to build - echo "===== $UI : $NAME =====" - - # try to compile, track result, and rename compiled files - if bin/build.sh "$TARGET" ; then - HEX_OUT="hex/$UI.$NAME.hex" - mv -f "ui/$UI/$UI".hex "$HEX_OUT" - MD5=$(md5sum "$HEX_OUT" | cut -d ' ' -f 1) - echo " # $MD5" - echo " > $HEX_OUT" - PASS=$((PASS + 1)) - PASSED="$PASSED $NAME" - else - echo "ERROR: build failed" - FAIL=$((FAIL + 1)) - FAILED="$FAILED $NAME" - fi - -done - -# summary -echo "===== $PASS builds succeeded, $FAIL failed =====" -#echo "PASS: $PASSED" -if [ 0 != $FAIL ]; then - echo "FAIL:$FAILED" - exit 1 -fi + + # summary + echo "===== $PASS builds succeeded, $FAIL failed =====" + #echo "PASS: $PASSED" + if [ 0 != $FAIL ]; then + echo "FAIL:$FAILED" + exit 1 + fi +} + +function make-version-h { + # old: version = build date + #date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h + + REV=$(bin/version-string.sh c) + # save the version name to version.h + mkdir -p ".build/$UI" + echo '#define VERSION_NUMBER "'"$REV"'"' > ".build/$UI/version.h" +} + +main "$@" + diff --git a/bin/build.sh b/bin/build.sh index 9b4b0b3..d044ca5 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -49,7 +49,7 @@ export CPP=avr-cpp export OBJCOPY=avr-objcopy export DFPFLAGS="-B $DFPPATH/gcc/dev/$MCUNAME/ -I $DFPPATH/include/" # TODO: include $user/ first so it can override other stuff -INCLUDES="-I ui -I hw -I. -I.. -I../.. -I../../.." +INCLUDES="-I .build -I ui -I hw -I. -I.. -I../.. -I../../.." export CFLAGS=" -Wall -g -Os -mmcu=$MCUNAME -c -std=gnu99 -fgnu89-inline -fwhole-program $MCUFLAGS $INCLUDES -fshort-enums $DFPFLAGS" export CPPFLAGS="-Wall -g -Os -mmcu=$MCUNAME -C -std=gnu99 -fgnu89-inline -fwhole-program $MCUFLAGS $INCLUDES -fshort-enums $DFPFLAGS" export OFLAGS="-Wall -g -Os -mmcu=$MCUNAME -mrelax $DFPFLAGS" diff --git a/bin/make-release.sh b/bin/make-release.sh new file mode 100755 index 0000000..da985d1 --- /dev/null +++ b/bin/make-release.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# Create a release file for Anduril .hex files. +# Copyright (C) 2023 Selene ToyKeeper +# SPDX-License-Identifier: GPL-3.0-or-later + +set -e # abort on error + +# run from repo root +REPODIR=$(dirname "$0")/.. +cd "$REPODIR" + +# get rid of 1st arg if it's "release" passed from 'make' +[[ "$1" = "release" ]] && shift + +# try to get the repo ready for a release +# (or not; probably better to do these steps manually) +#make clean +#make + +# release name +#REV=$(date +'%Y-%m-%d') +REV=$(git describe --tags --dirty --match='r2*') +REV="${REV:1}" # convert 'r2023-...' to '2023-...' +# allow manually specifying a release name +[[ -n "$1" ]] && REV="$1" + +# releases are named "$project.$revision" +RELNAME="anduril.$REV" + +# release directory +RELDIR="releases/$RELNAME" +mkdir -p "$RELDIR" "$RELDIR/hex" + +# add documentation and stuff +cp -a \ + ChangeLog.md \ + LICENSE \ + MODELS \ + README.md \ + docs/anduril-manual.md \ + docs/battery-rainbow.png \ + docs/which-hex-file.md \ + "$RELDIR" + +# add the .hex files +rename -f 's|hex/anduril.|'"$RELDIR/hex/$RELNAME"'.|;' hex/*.hex + +# make a .zip file +cd releases +mkdir -p zip +ZPATH=zip/"$RELNAME".zip +zip -q -r "$ZPATH" "$RELNAME" +cd .. +ls -l "releases/$ZPATH" + diff --git a/bin/models.py b/bin/models.py index 8e54d1c..1a1152e 100755 --- a/bin/models.py +++ b/bin/models.py @@ -24,12 +24,18 @@ def main(args): foo.sort() models = [x[-1] for x in foo] + colsizes = [ + max(len(m.model) for m in models), + max(len(m.mcu) for m in models), + max(len(m.name) for m in models), + ] + print('Models: %i\n' % len(models)) - fmt = '%s\t%-30s\t%s' - print(fmt % ('Model', 'Name', 'MCU')) - print(fmt % ('-----', '----', '---')) + fmt = '%%-%is %%-%is %%s' % (colsizes[0], colsizes[1]) + print(fmt % ('Model', 'MCU', 'Name')) + print(fmt % ('-----', '---', '----')) for m in models: - print(fmt % (m.model, m.name, m.mcu)) + print(fmt % (m.model, m.mcu, m.name)) print('\nDuplicates:') for i, m in enumerate(models): @@ -56,6 +62,7 @@ def load_model(path): m.name = path.replace('hw/','').replace('/', '-') m.mcu = inherit(path, 'arch') m.model = inherit(path, 'model') + if m.model: m.model = model_translate(m.model) return m @@ -73,6 +80,24 @@ def inherit(path, field): return None +def model_translate(m): + """Convert raw ordinal hex codes into human-friendly a-f digits. + """ + m = str(m) + replace = { + chr(ord('0') + 10): 'a', + chr(ord('0') + 11): 'b', + chr(ord('0') + 12): 'c', + chr(ord('0') + 13): 'd', + chr(ord('0') + 14): 'e', + chr(ord('0') + 15): 'f', + } + for s, r in replace.items(): + m = m.replace(s, r) + + return m + + if __name__ == "__main__": import sys main(sys.argv[1:]) diff --git a/bin/version-string.sh b/bin/version-string.sh new file mode 100755 index 0000000..c1c5155 --- /dev/null +++ b/bin/version-string.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Print a version string for the currently-checked-out code. +# Copyright (C) 2023 Selene ToyKeeper +# SPDX-License-Identifier: GPL-3.0-or-later + +# Usage: version-string.sh [c|git|both] +# Prints in C or Git format. Defaults to both. + +function main { + # eat first arg if invoked via 'make' + [[ "version" = "$1" ]] && shift + + # default to showing both formats + ARGS="$*" + [[ -z "$ARGS" ]] && ARGS="both" + + for arg in $ARGS ; do + case "$arg" in + git|g) + git-describe + ;; + c|C) + c-version-string + ;; + *) + echo -n 'C: ' ; c-version-string + echo -n 'git: ' ; git-describe + ;; + esac + done +} + +function git-describe { + git describe --tags --dirty --match='r2*' +} + +function c-version-string { + # version = git tag + revs since + dirty flag + REV=$(git-describe) + # convert "r2020-01-01-158-g0abcdef-dirty" to "2020-01-01+158#1" + REV=$(echo "$REV" | + sed -E 's/^r//; + s/-dirty/#1/; + s/-g[0-9a-f]+//; + s/^([0-9]{4}-[0-9]{2}-[0-9]{2})-/\1+/; + ' + ) + # handle an empty name (can happen during github action runs) + if [[ -z "$REV" ]]; then + HASH=$(git describe --always) + REV="0.$HASH" + fi + # print the version string + echo "$REV" +} + +main "$@" + diff --git a/docs/anduril-manual.md b/docs/anduril-manual.md index 93c6428..68c577c 100644 --- a/docs/anduril-manual.md +++ b/docs/anduril-manual.md @@ -728,26 +728,63 @@ Version Check Mode ------------------ This allows people to see which version of the firmware is installed on -their light. The format for this is (usually) 12 digits -- a model -number and a date. `BBPP.YYYY-MM-DD` +their light. The format for this is usually a model number and a date. +`MODEL.YYYY-MM-DD` - - `BB`: Brand ID - - `PP`: Product ID + - `MODEL`: Model number + (usually `BBPP` where BB is the brand ID, and PP is the product ID) - `YYYY`: Year - `MM`: Month - `DD`: Day -Versions before 2023-05-30 used `YYYYMMDDBBPP` format. -Anduril 1 used only `YYYYMMDD` format, or none at all. +The version number format has changed a few times, so write down the version +info and check it against the formats below. -The date is when the firmware was compiled. If the vendor did not set -this value, it defaults to 1969-07-20, the date of first human contact -with the moon. However, it might not be a date at all; some vendors may -specify a completely different type of value here. +The model number is very important when flashing new firmware. Make sure +the new firmware has the same model number as the old firmware. More details +on this are in [Which Hex File](which-hex-file.md). Use the +[MODELS](../MODELS) file to map a model number to the name of a .hex file. -The brand/product values are also known as the model number. These are -hard-coded in the source code for each light's build target, and can be -looked up in the "MODELS" file or by using the "make models" command. +## Version Check Formats + +The Version Check function should blink out a series of numbers in one of +several formats: + + - `MODEL-YYYY-MM-DD-SINCE-DIRTY` + Anduril 2 from 2023-12 or later. "SINCE" and "DIRTY" may be omitted. + Punctuation makes a "buzz" between sections. + - `MODEL`: model number + - `YYYY-MM-DD`: Year, month, day. This uses the most recent release tag + from git, not the build date. + - `SINCE`: How many commits since the last official release tag? + - `DIRTY`: Adds a "-1" to the end if the repository was locally modified + without committing changes. + + - `NNNN-YYYY-MM-DD` + Anduril 2 from 2023-05 or later. + It's a model number and build date, + with "buzz" flashes between sections. + - `NNNN`: model number + - `YYYY`: year + - `MM`: month + - `DD`: day + + - `YYYYMMDDNNNN` + Anduril 2 from 2023-05 or earlier. + It's a build date and model number. + +- `YYYYMMDD` + This is an old Anduril 1 version. It's just a build date. + If the model name isn't obvious, try looking it up in the PRODUCTS file. + +- `1969-07-20` + The date of first human contact with the moon. This value indicates that + the person who built the firmware probably made some sort of error. + +If the version doesn't include a model number, you may be able to find +the model in the PRODUCTS file to see which firmware model it probably uses: + + https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/anduril2/view/head:/PRODUCTS Protection Features @@ -811,6 +848,8 @@ In voltage mode, the colors follow the same sequence, in the same order as a rainbow... with red indicating a low battery and purple indicating a full battery. + + For lights with a button LED, the button LED typically stays on while the main emitters are on. Its brightness level is set in a way which mirrors the main LED -- off, low, or high. diff --git a/docs/battery-rainbow.png b/docs/battery-rainbow.png Binary files differnew file mode 100644 index 0000000..499866d --- /dev/null +++ b/docs/battery-rainbow.png diff --git a/docs/which-hex-file.md b/docs/which-hex-file.md index d59c6bd..3847217 100644 --- a/docs/which-hex-file.md +++ b/docs/which-hex-file.md @@ -1,41 +1,21 @@ # How to figure out which .hex file to use -1. Use the version check function (15 or more clicks from Off) to find out +The name of a product is **not** enough information to find the right .hex +file. Ask the light what firmware it needs! + +1. Use the Version Check function (15 or more clicks from Off) to find out which flavor of the firmware the light has installed. **WRITE THIS DOWN.** 2. Look up the model number in the [MODELS file](../MODELS), to get the name and MCU type. -3. Find the newest firmware for that model. - https://github.com/ToyKeeper/anduril/releases - https://toykeeper.net/torches/fsm/anduril2/?C=M;O=D - -If the version doesn't include a model number, you may be able to find -the model in the PRODUCTS file to see which version it probably uses: - - https://bazaar.launchpad.net/~toykeeper/flashlight-firmware/anduril2/view/head:/PRODUCTS - - -## Version Check Formats - -The Version Check function should blink out a series of numbers in one of -several formats: - - - `NNNN-YYYY-MM-DD` - Anduril 2 from 2023-05 or later. - It's a model number and build date, - with "buzz" flashes between sections. - - `NNNN`: model number - - `YYYY`: year - - `MM`: month - - `DD`: day - - - `YYYYMMDDNNNN` - Anduril 2 from 2023-05 or earlier. - It's a build date and model number. +3. Find (or build) the newest firmware for that model. + https://github.com/ToyKeeper/anduril/releases -- `YYYYMMDD` - This is an old Anduril 1 version. It's just a build date. - If the model name isn't obvious, try looking it up in the PRODUCTS file. +The Version Check format has changed a few times. Use +[this section of the manual](anduril-manual.md#Version_Check_Formats) +to learn about those formats and how to use them. In most cases, it should +have a model number and a date... and you need the model number to find the +correct .hex file. @@ -8,4 +8,8 @@ Fireflies 0400 - 0499 Mateminco 0500 - 0599 Sofirn 0600 - 0699 Wurkkos 0700 - 0799 -gChart 1600 - 1699 +... +gChart 1600 - 1699 (also thefreeman, since he picked 163X) +... +reserved 1900 - 2199 (to ensure no overlap between years and model numbers) + (assumes this project won't be relevant in the year 2200 or later) diff --git a/hw/lumintop/fw3x-lume1/README.md b/hw/lumintop/fw3x-lume1/README.md index 8609c49..190cd0e 100644 --- a/hw/lumintop/fw3x-lume1/README.md +++ b/hw/lumintop/fw3x-lume1/README.md @@ -10,6 +10,11 @@ sensor. LoneOceans sent a fixed driver design to Lumintop, but the new design didn't get produced. So to flash firmware, swap the wires for those two pins first. +**Fuses**: Lumintop seems to have shipped the FW3X with the wrong fuse values, +so it has the MCU severely underclocked and everything runs much slower than it +should. Use [flash-tiny1634-fuses.sh](../../../bin/flash-tiny1634-fuses.sh) to +fix those fuse values and get it running at the correct speed. + **RGB mixup**: Lumintop seems to have swapped the wires for aux R and aux B. This was fixed in firmware in 2023-12, but some lights were fixed in hardware before that, so the firmware fix might cause the colors to be swapped again. @@ -27,6 +27,7 @@ Usage: ./make TASK docs Convert all .md files to .html models Generate the MODELS file release Zip up all .hex files to prep for publishing a release + version Show the current version string todo Show tasks noted in source code files ... or TASK can be the partial name of a build target. @@ -73,7 +74,10 @@ function main() { cat MODELS ;; release) - echo "Not implemented yet." + ./bin/make-release.sh "$@" + ;; + version) + ./bin/version-string.sh "$@" ;; todo) grep -E 'TODO:|FIXME:' -- **/*.[ch] **/*.md |
