Skip to content

Commit

Permalink
devsync 45ae077
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2k committed Nov 14, 2024
1 parent dc35138 commit 3a6a2c8
Show file tree
Hide file tree
Showing 19 changed files with 885 additions and 118 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: codeberg_sync
run: |
git remote add --mirror=fetch secondary https://${{ secrets.CODEBERG_AUTH }}@codeberg.org/eh2k/squares-and-circles.git
git fetch origin
git push secondary --all --force
- name: Set up Python
uses: actions/setup-python@v2
- name: build
Expand All @@ -27,11 +22,14 @@ jobs:
arm-none-eabi-gcc --version
pip install intelhex subprocess32 pyelftools Jinja2 platformio elf_size_analyze
git submodule update --init
sh ./app/build.sh --rebuild
pio run -v --environment squares-and-circles
git --no-pager diff
git checkout -- .
- name: pack_artifacts
- name: deploy
run: |
git remote add --mirror=fetch secondary https://${{ secrets.CODEBERG_AUTH }}@codeberg.org/eh2k/squares-and-circles.git
git fetch origin
git push secondary --all --force
export hash=$(git rev-parse --short HEAD)
for f in .pio/build/*/*.hex; do
FIRMWARE=$(basename $(dirname ${f%.*}))
Expand Down
96 changes: 96 additions & 0 deletions .pio/builder/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
from SCons.Script import DefaultEnvironment, Default
import shutil, os
import subprocess
import json
import shutil
import io
import zlib
import time
import intelhex # pip install intelhex - #https://python-intelhex.readthedocs.io/en/latest/part2-2.html
import os, json, io

env = DefaultEnvironment()

# if env.get("PROGNAME", "program") == "program":
# env.Replace(PROGNAME="firmware")

# print(env.Dump())

env.AddPlatformTarget(
"build", None, env.GetBuildPath(f"$PROJECT_DIR/app/build.sh"), "Upload"
)
env.AddPlatformTarget(
"upload", "build", env.GetBuildPath(f"$PROJECT_DIR/app/upload.py"), "Upload"
)


def udynlink_size(file):
with open(file, "rb") as f:
f.read(4)
l = int.from_bytes(f.read(2), byteorder="little") # num_lot
r = int.from_bytes(f.read(2), byteorder="little")
# num_rels
a = int.from_bytes(f.read(4), byteorder="little")
# symt_size
b = int.from_bytes(f.read(4), byteorder="little")
# code_size
c = int.from_bytes(f.read(4), byteorder="little")
# data_size
d = int.from_bytes(f.read(4), byteorder="little")
# bss_size
h = 24 + (r * 8) + a
return h + b + c


def make_engines_hex(apps_json, ih=intelhex.IntelHex(), offset=int(1024 * 1024 / 2)):

print(apps_json)
if not os.path.exists(apps_json):
print(apps_json, "not found!")
else:
with open(apps_json) as f:
apps = json.load(f)
i = 1
for file in apps["apps"]:
bin_file = os.path.dirname(apps_json) + "/" + str(file)
if not os.path.exists(bin_file):
continue
bin_size = os.path.getsize(bin_file)

ih.loadbin(bin_file, offset=offset)
bin_offset = offset
offset += bin_size
with open(bin_file, "rb") as f:
crc32sum = zlib.crc32(f.read())
ih.puts(offset, crc32sum.to_bytes(4, "little"))
offset += 4

print(
i,
"0x%x" % bin_offset,
bin_file,
bin_size,
udynlink_size(bin_file) % 4,
"CRC32: %x" % crc32sum,
)
i += 1
offset += 4096 - (offset % 4096)

ih.puts(offset, 0xFFFF.to_bytes(4, "little"))
return ih


def post_program_action(source, target, env):
apps_json = env.GetProjectOption("apps_json")
ahx = make_engines_hex(apps_json)
program_path = env.GetBuildPath("$PROJECT_DIR/.pio/build/$PIOENV/engines.hex")
ahx.tofile(program_path, format="hex")
loader_sha = env.GetBuildPath("$PROJECT_DIR/.pio/build/$PIOENV/loader.sha")
with open(loader_sha, "w") as f:
f.write(env.GetProjectOption("squares_and_circles_loader"))
print(program_path, len(ahx))


env.AddPostAction("build", post_program_action)

Default(["build"])
10 changes: 10 additions & 0 deletions .pio/platform.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "squares-and-circles",
"keywords": [],
"engines": {
"platformio": "^6"
},
"version": "0.0.0",
"frameworks": {},
"packages": {}
}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
<summary><b>ChangeLog</b></summary>

````
== 2024-11-07
* Bugfix:
* M-OSC/Waveforms - V_OCT modulation
* SEQ/EuclidArp - Screensaver circle offset
* Crash on patch saving/restoring (#97 ?!)
* New Engines:
* SEQ/TuringMachine
== 2024-11-04
* Bugfix
* 808ish-BD Crash #103
Expand Down Expand Up @@ -282,7 +289,7 @@ E.g you can chain the mono audio signal from an oscillator machine to the neighb
* **SEQ**
* [EuclidRythm](https://github.com/eh2k/squares-and-circles/wiki/EuclidRythm)
* [EuclidArp](https://github.com/eh2k/squares-and-circles/wiki/EuclidArp)

* [TuringMachine](https://github.com/eh2k/squares-and-circles/wiki/TM)

## Machine/Engine

Expand Down
Binary file modified app/M-OSC/Waveforms.bin
Binary file not shown.
5 changes: 2 additions & 3 deletions app/M-OSC/Waveforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ VcoJitterSource jitter_source;

uint8_t sync_samples[FRAME_BUFFER_SIZE] = {};

int32_t _pitch = DEFAULT_NOTE;
int32_t _pitch = 0;
int32_t _shape = 0;
int32_t _timbre = UINT16_MAX / 2;
int32_t _color = UINT16_MAX / 2;
Expand All @@ -69,14 +69,13 @@ void engine::setup()
settings.SetValue(SETTING_PITCH_OCTAVE, 4);
settings.SetValue(SETTING_PITCH_RANGE, PITCH_RANGE_EXTERNAL);

engine::addParam(V_OCT, &_pitch, 0, 255);
engine::addParam(V_OCT, &_pitch, -4 * PITCH_PER_OCTAVE, 4 * PITCH_PER_OCTAVE); // is added internal to engine::cv
engine::addParam("Shape", &_shape, braids::MACRO_OSC_SHAPE_CSAW, braids::MACRO_OSC_SHAPE_LAST - 1, (const char **)braids::settings.metadata(braids::Setting::SETTING_OSCILLATOR_SHAPE).strings);
engine::addParam("Timbre", &_timbre, 0, UINT16_MAX);
engine::addParam("Color", &_color, 0, UINT16_MAX);
engine::addParam("Decay", &_decay, 0, UINT16_MAX);
engine::addParam("Attack", &_attack, 0, UINT16_MAX);
engine::setMode(ENGINE_MODE_STEREOLIZED);

}

void engine::process()
Expand Down
Binary file modified app/SEQ/EuclidArp.bin
Binary file not shown.
Binary file added app/SEQ/TuringMachine.bin
Binary file not shown.
Loading

0 comments on commit 3a6a2c8

Please sign in to comment.