Skip to content

Commit

Permalink
Merge pull request #13 from vladkorotnev/develop
Browse files Browse the repository at this point in the history
v4.1
  • Loading branch information
vladkorotnev authored Oct 20, 2024
2 parents c673236 + 7199dbb commit 488e98f
Show file tree
Hide file tree
Showing 135 changed files with 11,270 additions and 2,182 deletions.
20 changes: 20 additions & 0 deletions .github/actions/prepare_pio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Prepare PIO environment

on: [workflow_call]

jobs:
prepare_pio:
name: Set up PIO environment
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build production version

on:
push:
branches: [main]

jobs:
build-everything:
runs-on: ubuntu-latest
name: Build All Binaries
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare environment
uses: ./.github/actions/prepare_pio
- name: Build all targets
run: pio run
continue-on-error: true # TODO make this more graceful
- name: Upload firmware images
uses: actions/upload-artifact@v4
with:
name: filesystem
path: ./.pio/build/*/firmware.bin
if-no-files-found: error
- name: Delete WIP tunes
run: rm ./music/wip_*.pomf
- name: Create LittleFS image
run: pio run --target buildfs --environment music-pomf
- name: Upload filesystem image
uses: actions/upload-artifact@v4
with:
path: ./.pio/build/music-pomf/littlefs.bin
if-no-files-found: error
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ You can also read the quest I went through trying to get it to run "in real time
* [Roxette — Stars](https://www.youtube.com/watch?v=uzZRdjXd2qw): [MIDI](helper/chimes/stars.mid), [MP3 Recording](docs/rec/stars.mp3)
* [HIRO — Space Harrier](https://datadiscs.bandcamp.com/track/main-theme): [MIDI](helper/chimes/space_harrier.mid) (scale altered for 1-bit output range)
* [A-ha — Take On Me](https://www.youtube.com/watch?v=djV11Xbc914): [MIDI](helper/chimes/takeonme.mid)
* [Ennio Morricone - My Name Is Nobody](https://www.youtube.com/watch?v=srSpyXwz-MQ): [MIDI](helper/chimes/mynameisnobody.mid)
* [PPK - ResuRection (ППК - Воскрешение)](https://www.youtube.com/watch?v=KvOR2E_hZsw): [MIDI](helper/chimes/ppk.mid)
* [Owl City - Fireflies](https://www.youtube.com/watch?v=psuRGfAaju4): [MIDI](helper/chimes/fireflies.mid)
* [Ado - Odo](https://www.youtube.com/watch?v=YnSW8ian29w): [MIDI](helper/chimes/odo.mid)

## Creating your own melodies

All melodies and their samples are stored in a simple format called Portable Music Format, or PoMF :3c for short. The format is described in it's [header](include/sound/pomf.h), and all of the PoMF files are generated by the compiler from the [music](src/music) folder using [Elf2Pomf](helper/elf2pomf.py).

There is a MIDI to sequencer conversion tool (supports note events in one track only, track end event, and comment event): [midi_to_chime](helper/midi_to_chime.py)

8 bit 8 kHz wave to RLE sample conversion tool (not even reading the header, so very jank): [pwm.py](helper/pwm.py)
Expand Down Expand Up @@ -198,7 +204,7 @@ An ESP32-WROVER is required, because the firmware takes up 99.8% of an OTA parti
### Display (at least one required)

* Morio Denki 16101DS (see [below](#morio-denki-plasma-display-info), [driver](src/display//md_plasma.cpp), feature flag `HAS_OUTPUT_MD_PLASMA`)
* Winstar WEG010016A in 8-bit parallel mode ([driver](src/display/ws0010.cpp), feature flag `HAS_OUTPUT_WS0010`)
* Winstar WEG010016A in 8-bit parallel mode ([driver](src/display/ws0010.cpp), feature flag `HAS_OUTPUT_WS0010`). Includes BFI (Black Frame Insertion) for smoother operation and dimming.

### Speaker (at least one required)

Expand Down
Binary file modified data/music/001_caramelldansen.pomf
Binary file not shown.
Binary file modified data/music/002_duvet.pomf
Binary file not shown.
Binary file modified data/music/003_haruhi_no_omoi.pomf
Binary file not shown.
Binary file modified data/music/004_hishoku.pomf
Binary file not shown.
Binary file modified data/music/005_like_the_wind.pomf
Binary file not shown.
Binary file modified data/music/006_waiting_freqs.pomf
Binary file not shown.
Binary file modified data/music/007_the_way.pomf
Binary file not shown.
Binary file modified data/music/008_guitar_hero.pomf
Binary file not shown.
Binary file modified data/music/009_shabon.pomf
Binary file not shown.
Binary file modified data/music/010_steiner.pomf
Binary file not shown.
Binary file modified data/music/011_towa.pomf
Binary file not shown.
Binary file modified data/music/012_mermaid_girl.pomf
Binary file not shown.
Binary file modified data/music/013_eye_opener.pomf
Binary file not shown.
Binary file modified data/music/014_truth.pomf
Binary file not shown.
Binary file modified data/music/015_wpip.pomf
Binary file not shown.
Binary file modified data/music/016_am_arise.pomf
Binary file not shown.
Binary file modified data/music/017_bouken.pomf
Binary file not shown.
Binary file modified data/music/018_gentle_jena.pomf
Binary file not shown.
Binary file modified data/music/019_gammapolisz.pomf
Binary file not shown.
Binary file modified data/music/021_skibidi.pomf
Binary file not shown.
Binary file modified data/music/024_in_the_80s.pomf
Binary file not shown.
Binary file added data/music/034_ppk.pomf
Binary file not shown.
Binary file added data/music/035_fireflies.pomf
Binary file not shown.
Binary file added data/music/036_odo.pomf
Binary file not shown.
Binary file modified helper/chimes/arise.mid
Binary file not shown.
Binary file modified helper/chimes/ark.mid
Binary file not shown.
Binary file modified helper/chimes/bouken.mid
Binary file not shown.
Binary file modified helper/chimes/caramelldansen.mid
Binary file not shown.
Binary file modified helper/chimes/duvet.mid
Binary file not shown.
Binary file modified helper/chimes/eye_opener.mid
Binary file not shown.
Binary file added helper/chimes/fireflies.mid
Binary file not shown.
Binary file modified helper/chimes/gammapolisz.mid
Binary file not shown.
Binary file modified helper/chimes/gentlejena.mid
Binary file not shown.
Binary file modified helper/chimes/gtrhero.mid
Binary file not shown.
Binary file modified helper/chimes/haruhi_no_omoi.mid
Binary file not shown.
Binary file modified helper/chimes/inthe80s.mid
Binary file not shown.
Binary file modified helper/chimes/kamippoina.mid
Binary file not shown.
Binary file modified helper/chimes/like_the_wind.mid
Binary file not shown.
Binary file added helper/chimes/odo.mid
Binary file not shown.
Binary file added helper/chimes/ppk.mid
Binary file not shown.
Binary file modified helper/chimes/resublimity.mid
Binary file not shown.
Binary file modified helper/chimes/shakeit.mid
Binary file not shown.
Binary file modified helper/chimes/skibidi_toilet.mid
Binary file not shown.
Binary file modified helper/chimes/steiner.mid
Binary file not shown.
Binary file modified helper/chimes/syabon.mid
Binary file not shown.
Binary file modified helper/chimes/the_way.mid
Binary file not shown.
Binary file modified helper/chimes/towa.mid
Binary file not shown.
Binary file modified helper/chimes/truth.mid
Binary file not shown.
Binary file modified helper/chimes/waiting_freqs.mid
Binary file not shown.
Binary file modified helper/chimes/when_present_is_past.mid
Binary file not shown.
5 changes: 4 additions & 1 deletion helper/midi_to_chime.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def prev_note_off_event(chan):

for msg in mid:
print(msg)
if msg.time >= 0.01:
if msg.time > 0:
if len(evts) > 0 and evts[-1].kind == "DELAY":
evts[-1].arg += int(msg.time * 1000)
else:
evts.append(Event("DELAY", 0, int(msg.time * 1000)))
if msg.type == "note_on" or msg.type == "note_off":
if msg.type == "note_on" and msg.velocity > 0:
Expand Down
2 changes: 1 addition & 1 deletion helper/pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def median(data):
i += 1

print(f"static const uint8_t {sname}_rle_data[] = {{" + str(rle_buf)[1::][:-1:] + "};")
print(f"static const rle_sample_t {sname} = {{ .sample_rate = 8000, .root_frequency = 524 /* C5 */, .rle_data = {sname}_rle_data, .length = {len(rle_buf)}, .mode = MIX_MODE_ADD }};")
print(f"static const rle_sample_t {sname} = {{ .sample_rate = 8000, .root_frequency = 524 /* C5 */, .length = {len(rle_buf)}, .mode = MIX_MODE_ADD, .rle_data = {sname}_rle_data }};")
9 changes: 7 additions & 2 deletions include/app/idle.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
#include <sensor/sensor.h>
#include <sound/yukkuri.h>

void app_idle_prepare(SensorPool*, Beeper*, NewSequencer*, Yukkuri*);
void app_idle_init(SensorPool*, Beeper*, NewSequencer*, Yukkuri*);
void app_idle_prepare();
void app_idle_draw(FantaManipulator*);
void app_idle_process();

class AppShimIdle: public Renderable {
public:
AppShimIdle(SensorPool*sp, Beeper*b, NewSequencer*s, Yukkuri*y) {
app_idle_prepare(sp, b, s, y);
app_idle_init(sp, b, s, y);
}

void prepare() {
app_idle_prepare();
}

void render(FantaManipulator*fb) {
Expand Down
7 changes: 4 additions & 3 deletions include/app/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#include <sound/sequencer.h>
#include <sound/yukkuri.h>
#include <sensor/sensor.h>
#include <sensor/light.h>

class AppShimMenu: public ProtoShimNavMenu {
public:
AppShimMenu(Beeper*, NewSequencer*, Yukkuri*);
AppShimMenu(Beeper*, NewSequencer*, Yukkuri*, AmbientLightSensor*);

void prepare();
void step();
void prepare() override;
void step() override;

void pop_renderable(transition_type_t = TRANSITION_SLIDE_HORIZONTAL_RIGHT);

Expand Down
2 changes: 2 additions & 0 deletions include/app/musicbox.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <views/overlays/fireworks.h>
#include <views/overlays/rain_ovl.h>
#include <views/overlays/thunder_ovl.h>
#include <sound/sequencer.h>
Expand All @@ -18,6 +19,7 @@ class AppShimMusicbox : public WeatherChartCommon {
NewSequencer * seq;
RainOverlay * rain;
ThunderOverlay * thunder;
FireworksOverlay * fireworks;
int decay = 2;
int rise = 4;
int min_freq = 250;
Expand Down
1 change: 1 addition & 0 deletions include/app/new_year.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class NewYearAppShim: public Composite {
void prepare() override;
void render(FantaManipulator*) override;
void step() override;
void cleanup() override;

private:
enum DemoPhase {
Expand Down
11 changes: 9 additions & 2 deletions include/device_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
// Enable the yukkuri voice talking clock
#define HAS_AQUESTALK

// Disable the faux brightness reduction for some UI elements by drawing them only every other frame
// #define COMPOSABLE_NO_EVENODD

// ---- HARDWARE

#ifdef ESP32
Expand All @@ -38,8 +41,12 @@
#include <devices/mid_clock.h>
#endif

#ifdef DEVICE_MICROPISOS
#include <devices/smol_clock.h>
#ifdef DEVICE_MINIPISOS_VFD
#include <devices/mid_clock_noritake.h>
#endif

#ifdef DEVICE_MINIPISOS_VFD_WIDE
#include <devices/mid_clock_noritake_wide.h>
#endif

// ---- DEPENDENCY RULES
Expand Down
3 changes: 3 additions & 0 deletions include/devices/big_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#define HAS_MOTION_SENSOR
#define HAS_KEYPAD

// ↓ Looks like shite on the plasma display
#define COMPOSABLE_NO_EVENODD

// Plasma Information System OS (not DOS, there's no disk in it!)
#define PRODUCT_NAME "PIS-OS"
#define PRODUCT_VERSION "4"
Expand Down
4 changes: 2 additions & 2 deletions include/devices/mid_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const gpio_num_t HWCONF_WS0010_EN_GPIO = GPIO_NUM_18;

// ---- Connection of buttons ----
const keypad_definition_t HWCONF_KEYPAD = {
{GPIO_NUM_14, KEY_LEFT},
{GPIO_NUM_32, KEY_RIGHT},
{GPIO_NUM_14, KEY_RIGHT},
{GPIO_NUM_32, KEY_LEFT},
{GPIO_NUM_34, KEY_UP},
{GPIO_NUM_27, KEY_DOWN},
{GPIO_NUM_35, KEY_HEADPAT}, //<- finally a clock to have hardware headpat!
Expand Down
55 changes: 55 additions & 0 deletions include/devices/mid_clock_noritake.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#pragma once

#include <hal/gpio_hal.h>
#include <input/keypad.h>

#define HAS_OUTPUT_GU7000
#define HAS_TEMP_SENSOR
#define HAS_KEYPAD
#define HAS_SERIAL_MIDI
#define HAS_VARYING_BRIGHTNESS
#define HAS_LIGHT_SENSOR

// ↓ Looks like shite on the VFD display
#define COMPOSABLE_NO_EVENODD

// Plasma Information System OS (not DOS, there's no disk in it!)
#define PRODUCT_NAME "PIS-OS"
#define PRODUCT_VERSION "4"

// ---- Connection to beeper ----
const gpio_num_t HWCONF_BEEPER_GPIO = GPIO_NUM_33;
const uint8_t HWCONF_BEEPER_PWM_CHANNEL = 0;

// ---- Connection to temperature sensor ----
const gpio_num_t HWCONF_I2C_SDA_GPIO = GPIO_NUM_26;
const gpio_num_t HWCONF_I2C_SCL_GPIO = GPIO_NUM_25;

// ---- Connection to light sensors ----
const gpio_num_t HWCONF_LIGHTSENSE_GPIO = GPIO_NUM_36;

// ---- Connection to display ----
const gpio_num_t HWCONF_GU7000_DATABUS_GPIOS[] = {
GPIO_NUM_5,
GPIO_NUM_0,
GPIO_NUM_23,
GPIO_NUM_2,
GPIO_NUM_22,
GPIO_NUM_15,
GPIO_NUM_4,
GPIO_NUM_21
};
const gpio_num_t HWCONF_GU7000_WR_GPIO = GPIO_NUM_18;
const gpio_num_t HWCONF_GU7000_BUSY_GPIO = GPIO_NUM_19;

#define HWCONF_DISPLAY_WIDTH_PX 112
#define HWCONF_DISPLAY_HEIGHT_PX 16

// ---- Connection of buttons ----
const keypad_definition_t HWCONF_KEYPAD = {
{GPIO_NUM_14, KEY_RIGHT},
{GPIO_NUM_32, KEY_LEFT},
{GPIO_NUM_34, KEY_UP},
{GPIO_NUM_27, KEY_DOWN},
{GPIO_NUM_35, KEY_HEADPAT}, //<- finally a clock to have hardware headpat!
};
57 changes: 57 additions & 0 deletions include/devices/mid_clock_noritake_wide.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#include <hal/gpio_hal.h>
#include <input/keypad.h>

#define HAS_OUTPUT_GU7000
// #define HAS_TEMP_SENSOR
#define HAS_MOTION_SENSOR
#define HAS_KEYPAD
#define HAS_SERIAL_MIDI
#define HAS_VARYING_BRIGHTNESS
#define HAS_LIGHT_SENSOR

// ↓ Looks like shite on the VFD display
#define COMPOSABLE_NO_EVENODD

// Plasma Information System OS (not DOS, there's no disk in it!)
#define PRODUCT_NAME "wPIS-OS"
#define PRODUCT_VERSION "4"

// ---- Connection to beeper ----
const gpio_num_t HWCONF_BEEPER_GPIO = GPIO_NUM_33;
const uint8_t HWCONF_BEEPER_PWM_CHANNEL = 0;

// ---- Connection to temperature sensor ----
const gpio_num_t HWCONF_I2C_SDA_GPIO = GPIO_NUM_26;
const gpio_num_t HWCONF_I2C_SCL_GPIO = GPIO_NUM_25;

// ---- Connection to display ----
const gpio_num_t HWCONF_GU7000_DATABUS_GPIOS[] = {
GPIO_NUM_5,
GPIO_NUM_0,
GPIO_NUM_23,
GPIO_NUM_2,
GPIO_NUM_22,
GPIO_NUM_15,
GPIO_NUM_4,
GPIO_NUM_21
};
const gpio_num_t HWCONF_GU7000_WR_GPIO = GPIO_NUM_18;
const gpio_num_t HWCONF_GU7000_BUSY_GPIO = GPIO_NUM_19;

// ---- Connection to light sensors ----
const gpio_num_t HWCONF_MOTION_GPIO = GPIO_NUM_39;
const gpio_num_t HWCONF_LIGHTSENSE_GPIO = GPIO_NUM_36;

#define HWCONF_DISPLAY_WIDTH_PX 140
#define HWCONF_DISPLAY_HEIGHT_PX 16

// ---- Connection of buttons ----
const keypad_definition_t HWCONF_KEYPAD = {
{GPIO_NUM_14, KEY_RIGHT},
{GPIO_NUM_32, KEY_LEFT},
{GPIO_NUM_34, KEY_UP},
{GPIO_NUM_27, KEY_DOWN},
{GPIO_NUM_35, KEY_HEADPAT}, //<- finally a clock to have hardware headpat!
};
49 changes: 0 additions & 49 deletions include/devices/smol_clock.h

This file was deleted.

Loading

0 comments on commit 488e98f

Please sign in to comment.