From 45a77f7389103497148066a081a74988e07dd96f Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 16 Nov 2024 10:34:53 +0000 Subject: [PATCH] Create ini files on the fly --- .github/workflows/build.yml | 6 ++ .gitignore | 3 +- hwconfig/DT-DX.override | 46 +++++++++++++++ hwconfig/customize.sh | 20 +++++++ src/minidexed.ini.DT-DX | 109 ------------------------------------ 5 files changed, 74 insertions(+), 110 deletions(-) create mode 100644 hwconfig/DT-DX.override create mode 100755 hwconfig/customize.sh delete mode 100644 src/minidexed.ini.DT-DX diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8df5911..7d7433c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,6 +82,12 @@ jobs: zip -r ../MiniDexed_$GITHUB_RUN_NUMBER_$(date +%Y-%m-%d)-$(git rev-parse --short HEAD).zip * echo "artifactName=MiniDexed_$GITHUB_RUN_NUMBER_$(date +%Y-%m-%d)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV cd - + - name: Hardware configration files + run: | + cd hwconfig + sh -ex ./customize.sh + cd - + cp -r ./hwconfig/minidexed_* ./sdcard/ - uses: actions/upload-artifact@v3 with: name: ${{ env.artifactName }} # Exported above diff --git a/.gitignore b/.gitignore index 93bd001..5e9f987 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ sdcard CMSIS_5/ Synth_Dexed/ -circle-stdlib/ \ No newline at end of file +circle-stdlib/ +minidexed_* \ No newline at end of file diff --git a/hwconfig/DT-DX.override b/hwconfig/DT-DX.override new file mode 100644 index 0000000..1e6ba75 --- /dev/null +++ b/hwconfig/DT-DX.override @@ -0,0 +1,46 @@ +# DTronics DT-DX +# https://www.dtronics.nl/dt-dx + +SoundDevice=i2s +SampleRate=22000 +ChunkSize=256 +DACI2CAddress=0x0 +ChannelsSwapped=1 + +LCDEnabled=1 +LCDPinEnable=17 +LCDPinRegisterSelect=27 +LCDPinReadWrite=16 +LCDPinData4=22 +LCDPinData5=23 +LCDPinData6=24 +LCDPinData7=25 +LCDI2CAddress=0x00 + +SSD1306LCDI2CAddress=0x00 +SSD1306LCDWidth=128 +SSD1306LCDHeight=32 +SSD1306LCDRotate=0 +SSD1306LCDMirror=0 + +LCDColumns=16 +LCDRows=2 + +ButtonPinPrev=0 +ButtonActionPrev=0 +ButtonPinNext=0 +ButtonActionNext=0 +ButtonPinBack=26 +ButtonActionBack=longpress +ButtonPinSelect=26 +ButtonActionSelect=click +ButtonPinHome=26 +ButtonActionHome=doubleclick +ButtonPinShortcut=26 + +DoubleClickTimeout=400 +LongPressTimeout=400 + +EncoderEnabled=1 +EncoderPinClock=6 +EncoderPinData=5 \ No newline at end of file diff --git a/hwconfig/customize.sh b/hwconfig/customize.sh new file mode 100755 index 0000000..8a6f95f --- /dev/null +++ b/hwconfig/customize.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# This script creates a set of ini files from the *.override files +# to provide customized configurations for well-known hardware + +# Find all files named *.override, and run the following on each of them +for file in *.override; do + # Copy the file minidexed.ini to the name of this file but with .ini extension instead + name_of_ini_file=minidexed_$(echo "$file" | sed 's/\.override$/.ini/') + cp ../src/minidexed.ini "$name_of_ini_file" + + # Change the values in the ini file, leaving the rest of the file unchanged + while IFS='=' read -r key value; do + value=$(echo "$value" | tr -d '\r') + if [ -n "$value" ]; then + sed -i "s/^$key=.*/$key=$value/" "$name_of_ini_file" + fi + done < "$file" + echo "Created $name_of_ini_file" +done diff --git a/src/minidexed.ini.DT-DX b/src/minidexed.ini.DT-DX deleted file mode 100644 index 9e8852e..0000000 --- a/src/minidexed.ini.DT-DX +++ /dev/null @@ -1,109 +0,0 @@ -# -# minidexed.ini -# - -# Sound device -SoundDevice=i2s -#SoundDevice=pwm -#SoundDevice=hdmi -SampleRate=22000 -#ChunkSize=256 -DACI2CAddress=0x0 -#DACI2CAddress=0x98 -ChannelsSwapped=0 - -# MIDI -MIDIBaudRate=31250 -#MIDIThru=umidi1,ttyS1 -IgnoreAllNotesOff=0 -MIDIAutoVoiceDumpOnPC=1 -HeaderlessSysExVoices=0 -# Program Change enable -# 0 = Ignore all Program Change messages. -# 1 = Respond to Program Change messages. -MIDIRXProgramChange=1 -# Program Change mode -# 0 = Only recognise Program Change 0-31. -# 1 = Support 0-127 across four consecutive banks. -# NB: Only relevant if PerformanceSelectChannel=0 -ExpandPCAcrossBanks=1 -# Program Change action: -# 0 = Program Change messages select voices on the channel associated with each TG. -# 1-16 = Program Change messages on this channel select performances. -# >16 = Program Change messages on ANY channel select performances. -# NB: In performance mode, all Program Change messages on other channels are ignored. -PerformanceSelectChannel=0 - -# HD44780 LCD -LCDEnabled=1 -LCDPinEnable=17 -LCDPinRegisterSelect=27 -LCDPinReadWrite=16 -LCDPinData4=22 -LCDPinData5=23 -LCDPinData6=24 -LCDPinData7=25 -LCDI2CAddress=0x00 - -# SSD1306 LCD -# For a 128x32 display, set LCDColumns=20; LCDRows=2 -# For a 128x64 display, set LCDColumns=20; LCDRows=4 -#SSD1306LCDI2CAddress=0x3C -SSD1306LCDI2CAddress=0x00 -SSD1306LCDWidth=128 -SSD1306LCDHeight=32 -SSD1306LCDRotate=0 -SSD1306LCDMirror=0 - -# Default is 16x2 display (e.g. HD44780) -LCDColumns=16 -LCDRows=2 - -# GPIO Button Navigation -# Any buttons set to 0 will be ignored -ButtonPinPrev=0 -ButtonActionPrev= -ButtonPinNext=0 -ButtonActionNext= -ButtonPinBack=26 -ButtonActionBack=longpress -ButtonPinSelect=26 -ButtonActionSelect=click -ButtonPinHome=26 -ButtonActionHome=doubleclick -ButtonPinShortcut=26 -# (Shortcut doesn't have an action) - -# Timeouts in milliseconds for double click and long press -DoubleClickTimeout=400 -LongPressTimeout=400 - -# MIDI Button Navigation -# Specify MIDI CC to act as a button (0 = ununsed, so don't use CC 0) -# NB: Off < 64 < ON -# CC channel: 0=OFF; 1-16 MIDI Ch; >16 Omni -# If MIDIButtonNotes>0 then treat MIDIButton numbers as MIDI -# Note numbers, triggered with NoteOn/NoteOff, not CC numbers. -MIDIButtonCh=0 -MIDIButtonNotes=0 -MIDIButtonPrev=0 -MIDIButtonNext=0 -MIDIButtonBack=0 -MIDIButtonSelect=0 -MIDIButtonHome=0 -MIDIButtonPgmUp=0 -MIDIButtonPgmDown=0 -MIDIButtonTGUp=0 -MIDIButtonTGDown=0 - -# KY-040 Rotary Encoder -EncoderEnabled=1 -EncoderPinClock=6 -EncoderPinData=5 - -# Debug -MIDIDumpEnabled=0 -ProfileEnabled=0 - -# Performance -PerformanceSelectToLoad=1