Skip to content

Commit

Permalink
experimental support for MTP
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Nov 21, 2022
1 parent d6f863f commit f097e53
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This is a fork of [fwachsmuth/Synkino](https://github.com/fwachsmuth/Synkino) wi
* SynkinoLC uses only a few off-the-shelf components to make assembly as straightforward as possible. No SMD soldering is required.
* The firmware has been optimized to fit the 62K flash of the affordable but powerful Teensy LC microcontroller board (with a few limitations - see below). Teensy 3.2 is also supported.
* Unlike the original Synkino, SynkinoLC is not designed for battery operation. Use any micro-USB phone charger as a power supply unit.
* When connected to a PC/Mac via USB you'll have direct access to SynkinoLC's SD card via MTP (Teensy 3.2 only).

Most parts of [Friedemann's manual for the original Synkino](https://www.filmkorn.org/synkino-instruction-manual/?lang=en) apply for SynkinoLC as well.

Expand All @@ -21,6 +22,7 @@ When assembling SynkinoLC, you can chose between using a Teensy LC or Teensy 3.2
* You can store settings for "only" 7 projectors (vs 15 on Teensy 3.2).
* The USB stack has been omitted - you can't use debugging by means of USBSerial. You can, however, use the Teensy's HW serial interface (TX on pin 1, 31250 baud).
* SdFat is running in low-mem mode (no support for exFAT, limited to 32GB cards and 64 character filenames).
* No MTP access to the SD card.

Neither of these limitations should have a significant impact on the usability of SynkinoLC.

Expand Down
18 changes: 13 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@
[env]
platform = teensy
framework = arduino
extra_scripts =
pre:patches.py

[env:teensyLC]
lib_deps =
olikraus/U8g2 @ ^2.34.4
adafruit/Adafruit VS1053 Library @ 1.2.1
https://github.com/luni64/EncoderTool
alexiii/incbin @ ^0.1.2
luni64/TeensyTimerTool @ ^0.4.4
dlloydev/QuickPID @ ^3.1.2
extra_scripts =
pre:patches.py

[env:teensyLC]
board = teensylc
build_flags =
-D TEENSY_OPT_SMALLEST_CODE_LTO
Expand All @@ -34,8 +33,17 @@ build_flags =
-D U8G2_WITHOUT_FONT_ROTATION

[env:teensy31]
lib_deps =
olikraus/U8g2 @ ^2.34.4
adafruit/Adafruit VS1053 Library @ 1.2.1
https://github.com/luni64/EncoderTool
luni64/TeensyTimerTool @ ^0.4.4
dlloydev/QuickPID @ ^3.1.2
alexiii/incbin @ ^0.1.2
https://github.com/KurtE/MTP_Teensy
board = teensy31
build_flags =
-D INC_PATCHES
-D SERIALDEBUG
-D U8X8_NO_HW_I2C
-D USB_MTPDISK_SERIAL
8 changes: 8 additions & 0 deletions src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ extern PolledEncoder enc;
INCBIN(Patch, "patches.053");
#endif

// Use MTP disk?
#if defined USB_MTBDISK || defined USB_MTPDISK_SERIAL
#include <MTP_Teensy.h>
#endif

// macros for time conversion
#define SECS_PER_MIN (60UL)
#define SECS_PER_HOUR (3600UL)
Expand Down Expand Up @@ -221,6 +226,9 @@ bool Audio::selectTrack() {
beeTimer.stop();
while (state != QUIT) {
yield();
#if defined USB_MTBDISK || defined USB_MTPDISK_SERIAL
MTP.loop();
#endif

switch (state) {
case CHECK_FOR_LEADER:
Expand Down
15 changes: 15 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ using namespace EncoderTool;
#include "pins.h" // pin definitions
#include "menus.h" // menu definitions, positions of menu items

// Use MTP disk?
#if defined USB_MTBDISK || defined USB_MTPDISK_SERIAL
#include <SD.h>
#include <MTP_Teensy.h>
#define CS_SD VS1053_SDCS
#endif

// Declaration of functions
// See https://docs.platformio.org/en/latest/faq/ino-to-cpp.html
void dimDisplay(bool);
Expand Down Expand Up @@ -96,6 +103,11 @@ void setup(void) {
}
boardRevision[18] = musicPlayer.getRevision();

// initialize MTP filesystem
#if defined USB_MTBDISK || defined USB_MTPDISK_SERIAL
MTP.addFilesystem(SD, "SynkinoLC Storage");
#endif

projector.loadLast();

PRINTLN("Startup complete.\n");
Expand Down Expand Up @@ -222,6 +234,9 @@ void breathe(bool doBreathe) {
// This overwrites the weak function in u8x8_debounce.c
uint8_t u8x8_GetMenuEvent(u8x8_t *u8x8) {
yield();
#if defined USB_MTBDISK || defined USB_MTPDISK_SERIAL
MTP.loop();
#endif

if (enc.valueChanged()) {
buzzer.playClick(); // feedback sound
Expand Down

0 comments on commit f097e53

Please sign in to comment.