Commit Graph

34 Commits

Author SHA1 Message Date
Grigorii Merkushev
8700af8a24
Fine tuning for esp32s3 (#143)
- exposed strain SCK and DO
- use 12 bit PWM (instead of 16 bit) for screen brightness on s3
- added option to use uart serial for s3
- bump nanopb/Nanopb @ 0.4.7
- fixed SPI bus alias and DMA channel for s3

---------

Co-authored-by: Scott Bezek <scottbez1@gmail.com>
2023-11-13 22:42:44 -08:00
Scott Bezek
6d946c49e5 Handle RequestState messages; update python example 2023-10-28 15:42:28 -07:00
Scott Bezek
2eddc13528 Add a bunch of proto documentation 2023-09-10 17:25:23 -07:00
Scott Bezek
590ba8850c
Demo improvements (#135)
- LED hue config
- press state reporting
- custom display modes for timeline demo
2023-09-10 15:44:00 -07:00
Scott Bezek
d1495a8334 Strain calibration 2023-07-09 17:25:18 -07:00
Scott Bezek
948297fa82
Implement persistent configuration/calibration storage using FFAT (#124)
Reintroduces persistent configuration from #122, but using FFAT instead
of SPIFFS, since SPIFFS had bad performance impacts on the motor control
loop.
2023-06-19 13:13:08 -07:00
Scott Bezek
0ebbcc8c23 Revert "SPIFFS persistent storage for motor calibration (#122)"
Seems to be causing weird behavior/performance with the motor control loop, particularly noticeable with fine detents. Reverting for now until I have a chance to investigate further.

This reverts commit 1d73af17cc.
2023-06-17 10:54:55 -07:00
Scott Bezek
d64cc55432 Add missing partition file and update GH actions to run nanofoc build 2023-06-16 09:21:13 -07:00
Scott Bezek
1d73af17cc
SPIFFS persistent storage for motor calibration (#122)
- New Configuration class for managing persistent configuration
- New proto messages for serialized configuration, with flexibility for
expansion
- Load persistent configuration at startup, if available, use for
default motor calibration
- Save motor calibration to persistent configuration file
2023-06-14 22:43:20 -07:00
Scott Bezek
2afc38f7f9
Updated config schema, improved demo (#121)
- Breaking proto updates
- added position nonce to config, and added ability to specify a
sub_position via config as well => more flexibility to control position
via config
- added version as first field of serial protocol messages, so future
breaking proto updates can easily be detected and ignored
- Fixed up web-based demo of a mock video editor/timeline jog/playback
controller
- Fixed config/state flow so that mode changes correctly maintain
playback position
  - Demo: https://www.youtube.com/watch?v=J9192DfZplk
2023-06-13 22:45:49 -07:00
Scott Bezek
08146e292d Add some basic bounds checking during calibration 2023-06-13 22:29:40 -07:00
Baku 麦
3fdd9fa601
Use TFT_eSprite.drawNumber for the current position (#118)
I would suggest using `drawNumber` instead of drawString to align each
digit of the number to the same width and erase the jittering effect
when the current position is changed.
2023-06-13 22:03:57 -07:00
Scott Bezek
9903ac63e6
NanoFOC/ESP32-S3 support (#117)
- New PlatformIO env (`nanofoc`) for the NanoFOC hardware
  - Huge thanks to @lgc00 for the initial NanoFOC configuration and prototyping!
  - Uses `HWCDC` rather than `UartStream` as the serial `Stream` interface (ESP32-S3 specific change)
  - Support for MAQ430 magnetic encoder sensor
  - Motor-specific PID tuning constants moved to separate header files

---------

Co-authored-by: lgc00 <lgcasd1+1@gmail.com>
2023-05-29 17:17:55 -07:00
Scott Bezek
acfc85f72b
Python software example (#106)
Add protobuf/cobs/crc32 framework code and a really basic python example
2023-02-04 12:34:12 -08:00
Scott Bezek
9431ed3971
New detent configurations (magnetic and biased-to-center) and demo React app (#105)
Breaking change to protobuf messages to support new detent configurations - adds more flexibility compared to existing config parameters (e.g. min/max position rather than just number of positions).

New magnetic detent mode allows for config to specify up to 5 nearest detent positions (with smooth scrolling in between them); the intent is a higher-level controller (e.g. connected demo app, see below) to dynamically update that list as the position changes, in order to support an unlimited number of magnetic detents.

---

React demo app implements a mock video editor timeline, with the ability to interact with it via the SmartKnob connected over USB serial. (Currently uses a node backend to stream config/state to the frontend via websockets, but it would probably be possible to do everything on the frontend with webserial in the future?).

The 3 demo input modes are:
- Scroll: quickly smooth-scroll through the timeline, with magnetic detents at clip boundaries. Scroll speed is determined by zoom level (currently only controllable by mouse scroll wheel)
- Frames: small detents (1.5 degrees) to move frame-by-frame through video
- Speed/playback: "spring-loaded" speed control, biased to return to center (paused), with detents at powers of 2: 1x, 2x, 4x playback

Currently the frontend app has some bugs, particularly with the current playback position when switching modes and zooming, but planning to merge anyway to get the other breaking changes into master along with the initial demo framework.
2023-01-16 13:58:03 -08:00
Scott Bezek
ae28d523e0
Protobuf serial protocol (#101)
- Firmware
  - Refactor all code to use a log interface rather than `Serial` directly
  - Moved platformio.ini to root, so you can load the entire repo in VS Code and still use platformio
  - Reduced graphic buffer bit depth to 8 bits (short on RAM :( )
  - Implemented threadsafe log interface in interface_task (using a queue for posting log message)
  - Created serial protocol interface and 2 implementations - plaintext (default) and protobuf (selected by sending a NULL byte)
  - Protobuf protocol is roughly the same architecture as Splitflap's:
    - PacketSerial (cobs) framing with NULL delimiters
    - CRC32 checksums for packets
    - nanopb generated code for encoding/decoding (generated firmware code is checked in, since it should change less frequently and this reduces burden to build the project from scratch)
- Software
  - Typescript example host-side code:
    - smartknobjs-proto
      - Autogenerated types/encoding/decoding protobuf code (using protobufjs)
    - smartknobjs
      - Helper library for interfacing the with smartknob via serial/protobuf. Implements basic outgoing queue (with retries and ACK checking) and message callback for responding to messages from the SmartKnob
    - example
      - Basic demo CLI app that uses smartknobjs to connect to the smartknob, send a haptic config, and print state changes and log messages to the console
2022-10-22 17:27:35 -07:00
Scott Bezek
b286cfabe1 Firmware cleanup 2022-10-04 22:21:51 -07:00
Scott Bezek
604f21dcb6 Fix compilation error if SK_ALS=0 but PIN_SDA and PIN_SCL are set 2022-05-27 18:57:07 -07:00
Scott Bezek
e35319af6d Increase motor task stack
Avoid accidental stack overflows from small stack.

Updates #37
Updates #50
2022-04-07 10:20:24 -07:00
Scott Bezek
45fd9f4e3e Cleanup old pio envs, fix some compilation issues with compile flags
Removed some legacy platformio envs that are not actively being maintained. But also fixed some bugs with different build flags that caused compilation issues.

Fixes #49
2022-04-06 21:53:41 -07:00
Scott Bezek
b47fcf7da4
Firmware updates - sensors, calibration, View support, etc (#9)
- Modify TLV493d library to expose frame counter in order to check for lockup, and implement auto-reset in tlv_sensor in case of lockup
 - Implement MT6701 SimpleFOC sensor
 - Make display optional
 - Add optional LED, strain, ALS support
 - Connect ALS to LED and display brightness
 - Hardcoded strain gauge thresholds and haptic feedback
2022-03-10 19:05:49 -08:00
Scott Bezek
1c75fa0bb0 vscode recommendations 2022-02-13 09:38:39 -08:00
Scott Bezek
ad86663a6d Cleanup 2022-02-08 20:32:21 -08:00
Scott Bezek
f362039a95 Detent tweaks 2022-01-27 09:27:20 -08:00
Scott Bezek
723396f588 Reduce noise on coarse detents 2022-01-16 11:24:57 -08:00
Scott Bezek
b92b805e13 cleanup 2022-01-15 21:21:23 -08:00
Scott Bezek
b380a756c3 Better demo UI, show config name, tune for re-mounted motor 2022-01-15 21:13:23 -08:00
Scott Bezek
26373a9b4e firmware checkpoint 2021-11-01 22:38:36 -07:00
Scott Bezek
a33c46b29b Add button support 2021-10-25 21:44:37 -07:00
Scott Bezek
0b5785ecf3 Demo! 2021-10-24 22:23:05 -07:00
Scott Bezek
bbc51702ff Auto-adjust centerpoint when idle 2021-10-24 14:42:21 -07:00
Scott Bezek
51f43cf727 dead zone and end stops 2021-10-23 20:47:24 -07:00
Scott Bezek
d9b97f8a2a Basic detents 2021-10-22 15:59:51 -07:00
Scott Bezek
bb4ba9df1e initial checkin 2021-10-22 12:35:39 -07:00