Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #41

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Dev #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# bb colorcord binaries and debugging files
colorchord2/colorchord
*.bin
embedded8266/web/page.mpfs
embedded8266/web/tmp/
embedded8266/web/mfsmaker
embeddedlinux/embeddedcc
embeddedlinux/dummy_leds
embeddedlinux/dbout.txt


# Recommended for c-programs
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "embedded8266/esp82xx"]
path = embedded8266/esp82xx
url = https://github.com/cnlohr/esp82xx.git
url = https://github.com/bbkiwi/esp82xx.git

8 changes: 4 additions & 4 deletions colorchord2/cells_output.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#for a two-ring WS2812 light, 24 LEDs per layer, one layer clockwise, the other counter-clockwise.

outdrivers = DisplayPie,DisplayNetwork,OutputCells
leds = 48
leds = 16
light_siding = 1.9 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
satamp = 1.600
is_loop=1
Expand All @@ -12,7 +12,7 @@ skipfirst = 3
firstval = 0
port = 7777
#address = 192.168.11.231
address = 192.168.43.128
address = 192.168.20.9

slope=.10
amplify=.4
Expand All @@ -21,10 +21,10 @@ amplify=.4
compress_coefficient = 4.0
compress_exponent = .5

sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
sourcename = #alsa_output.pci-0000_00_1f.3.analog-stereo.monitor

fliprg = 1
skittlequantity = 24
skittlequantity = 8
timebased = 1

qtyamp = 30
5 changes: 3 additions & 2 deletions colorchord2/netlight_esp8266.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outdrivers = DisplayPie,DisplayNetwork, OutputLinear
leds = 276
leds = 16
light_siding = 1.0 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
satamp = 1.600
is_loop=0
Expand All @@ -20,7 +20,8 @@ sourcename = alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1.monitor
skipfirst = 1
firstval = 1
port = 7777
address = 192.168.4.1
#address = 192.168.4.1
address = 192.168.1.5

slope=.10
amplify=.3
Expand Down
10 changes: 6 additions & 4 deletions embedded8266/ccconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#define HPABUFFSIZE 512

#define CCEMBEDDED
#define NUM_LIN_LEDS 255
#define NUM_LIN_LEDS 16
#define DFREQ 16000


#define memcpy ets_memcpy
#define memset ets_memset

Expand Down Expand Up @@ -53,9 +54,10 @@ extern uint8_t gNERF_NOTE_PORP; //=15
extern uint8_t gUSE_NUM_LIN_LEDS; // = NUM_LIN_LEDS
#define USE_NUM_LIN_LEDS gUSE_NUM_LIN_LEDS

//We are not enabling these for the ESP8266 port.
#define LIN_WRAPAROUND 0
#define SORT_NOTES 0
//We are not enabling for the ESP8266 port.
//#define LIN_WRAPAROUND 0
//but trying this now
//#define SORT_NOTES 1



Expand Down
13 changes: 9 additions & 4 deletions embedded8266/user.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ COM_PORT = 7777
BACKEND_PORT = 7878
PAGE_OFFSET = 65536 # 1048576

#SLOWTICK_MS = 10 # bb overrides default of 50

#SDK_DEFAULT = $(HOME)/esp8266/esp-open-sdk
ESP_GCC_VERS = 4.8.5
SDK = $(HOME)/esp8266/esp_iot_sdk_v1.5.2
PAGE_SCRIPTS = main.js
SDK = $(ESP_ROOT)/esp_iot_sdk_v1.5.2

FWBURNFLAGS = -b 1000000
# using -b 1500000 flash often fails using mac, not win7
# commenting out burns slower but works
FWBURNFLAGS = -b 115200 # ok mac
#FWBURNFLAGS = -b 1500000 # ok win 7

OPTS += -DICACHE_FLASH
#OPTS += -DVERIFY_FLASH_WRITE
#OPTS += -DDEBUG
#OPTS += -DFREQ=12500


PAGE_TITLE = ColorChord Control Panel
PAGE_SCRIPT =
PAGE_SCRIPTS = main.js #bb
PAGE_HEADING = ColorChord: Embedded
PAGE_INFO =

23 changes: 15 additions & 8 deletions embedded8266/user/custom_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern volatile uint8_t sounddata[];
extern volatile uint16_t soundhead;


#define CONFIGURABLES 17 //(plus1)
#define CONFIGURABLES 22 //(plus1)

extern uint8_t RootNoteOffset; //Set to define what the root note is. 0 = A.
uint8_t gDFTIIR = 6;
Expand All @@ -29,23 +29,30 @@ uint8_t gNERF_NOTE_PORP = 15;
uint8_t gUSE_NUM_LIN_LEDS = NUM_LIN_LEDS;
uint8_t gCOLORCHORD_ACTIVE = 1;
uint8_t gCOLORCHORD_OUTPUT_DRIVER = 0;
uint8_t gCOLORCHORD_SHIFT_INTERVAL = 0;
uint8_t gCOLORCHORD_FLIP_ON_PEAK = 0;
int8_t gCOLORCHORD_SHIFT_DISTANCE = 0; //distance of shift
uint8_t gCOLORCHORD_SORT_NOTES = 0; // 0 no sort, 1 inc freq, 2 dec amps, 3 dec amps2
uint8_t gCOLORCHORD_LIN_WRAPAROUND = 0; // 0 no adjusting, else current led display has minimum deviation to prev



struct SaveLoad
{
uint8_t configs[CONFIGURABLES];
} settings;

uint8_t gConfigDefaults[CONFIGURABLES] = { 0, 6, 1, 2, 3, 4, 7, 4, 2, 80, 64, 12, 15, NUM_LIN_LEDS, 1, 0, 0 };
uint8_t gConfigDefaults[CONFIGURABLES] = { 0, 6, 1, 2, 3, 4, 7, 4, 2, 80, 64, 12, 15, NUM_LIN_LEDS, 1, 0, 0, 0, 0, 0, 0, 0 };

uint8_t * gConfigurables[CONFIGURABLES] = { &RootNoteOffset, &gDFTIIR, &gFUZZ_IIR_BITS, &gFILTER_BLUR_PASSES,
&gSEMIBITSPERBIN, &gMAX_JUMP_DISTANCE, &gMAX_COMBINE_DISTANCE, &gAMP_1_IIR_BITS,
&gAMP_2_IIR_BITS, &gMIN_AMP_FOR_NOTE, &gMINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR, &gNOTE_FINAL_AMP,
&gNERF_NOTE_PORP, &gUSE_NUM_LIN_LEDS, &gCOLORCHORD_ACTIVE, &gCOLORCHORD_OUTPUT_DRIVER, 0 };
&gNERF_NOTE_PORP, &gUSE_NUM_LIN_LEDS, &gCOLORCHORD_ACTIVE, &gCOLORCHORD_OUTPUT_DRIVER, &gCOLORCHORD_SHIFT_INTERVAL, &gCOLORCHORD_FLIP_ON_PEAK, &gCOLORCHORD_SHIFT_DISTANCE, &gCOLORCHORD_SORT_NOTES, &gCOLORCHORD_LIN_WRAPAROUND, 0 };

char * gConfigurableNames[CONFIGURABLES] = { "gROOT_NOTE_OFFSET", "gDFTIIR", "gFUZZ_IIR_BITS", "gFILTER_BLUR_PASSES",
"gSEMIBITSPERBIN", "gMAX_JUMP_DISTANCE", "gMAX_COMBINE_DISTANCE", "gAMP_1_IIR_BITS",
"gAMP_2_IIR_BITS", "gMIN_AMP_FOR_NOTE", "gMINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR", "gNOTE_FINAL_AMP",
"gNERF_NOTE_PORP", "gUSE_NUM_LIN_LEDS", "gCOLORCHORD_ACTIVE", "gCOLORCHORD_OUTPUT_DRIVER", 0 };
"gNERF_NOTE_PORP", "gUSE_NUM_LIN_LEDS", "gCOLORCHORD_ACTIVE", "gCOLORCHORD_OUTPUT_DRIVER","gCOLORCHORD_SHIFT_INTERVAL", "gCOLORCHORD_FLIP_ON_PEAK", "gCOLORCHORD_SHIFT_DISTANCE", "gCOLORCHORD_SORT_NOTES", "gCOLORCHORD_LIN_WRAPAROUND", 0 };

void ICACHE_FLASH_ATTR CustomStart( )
{
Expand Down Expand Up @@ -231,10 +238,10 @@ int ICACHE_FLASH_ATTR CustomCommand(char * buffer, int retsize, char *pusrdata,
i++;
}

buffend += ets_sprintf( buffend, "rBASE_FREQ=%d\trDFREQ=%d\trOCTAVES=%d\trFIXBPERO=%d\trNOTERANGE=%d\trSORT_NOTES=%d\t",
(int)BASE_FREQ, (int)DFREQ, (int)OCTAVES, (int)FIXBPERO, (int)(NOTERANGE),(int)SORT_NOTES );
buffend += ets_sprintf( buffend, "rMAXNOTES=%d\trNUM_LIN_LEDS=%d\trLIN_WRAPAROUND=%d\trLIN_WRAPAROUND=%d\t",
(int)MAXNOTES, (int)NUM_LIN_LEDS, (int)LIN_WRAPAROUND, (int)LIN_WRAPAROUND );
buffend += ets_sprintf( buffend, "rBASE_FREQ=%d\trDFREQ=%d\trOCTAVES=%d\trFIXBPERO=%d\trNOTERANGE=%d\t",
(int)BASE_FREQ, (int)DFREQ, (int)OCTAVES, (int)FIXBPERO, (int)(NOTERANGE) );
buffend += ets_sprintf( buffend, "rMAXNOTES=%d\trNUM_LIN_LEDS=%d\t",
(int)MAXNOTES, (int)NUM_LIN_LEDS );

return buffend-buffer;
}
Expand Down
12 changes: 10 additions & 2 deletions embedded8266/user/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#define procTaskPrio 0
#define procTaskQueueLen 1

int gFRAMECOUNT_MOD_SHIFT_INTERVAL = 0;
int gROTATIONSHIFT = 0; //Amount of spinning of pattern around a LED ring

static volatile os_timer_t some_timer;
static struct espconn *pUdpServer;

Expand All @@ -52,7 +55,9 @@ extern uint8_t gCOLORCHORD_OUTPUT_DRIVER;
static void NewFrame()
{
if( !gCOLORCHORD_ACTIVE ) return;

gFRAMECOUNT_MOD_SHIFT_INTERVAL++;
if ( gFRAMECOUNT_MOD_SHIFT_INTERVAL >= gCOLORCHORD_SHIFT_INTERVAL ) gFRAMECOUNT_MOD_SHIFT_INTERVAL = 0;
//printf("MOD FRAME %d ******\n", gFRAMECOUNT_MOD_SHIFT_INTERVAL);
//uint8_t led_outs[NUM_LIN_LEDS*3];
int i;
HandleFrameInfo();
Expand All @@ -65,10 +70,13 @@ static void NewFrame()
case 1:
UpdateAllSameLEDs();
break;
case 2:
UpdateRotatingLEDs();
break;
};

//SendSPI2812( ledOut, NUM_LIN_LEDS );
ws2812_push( ledOut, USE_NUM_LIN_LEDS * 3 );
ws2812_push( ledOut, NUM_LIN_LEDS * 3 );
}

os_event_t procTaskQueue[procTaskQueueLen];
Expand Down
24 changes: 13 additions & 11 deletions embedded8266/web/page/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ function GotOScope(req,data)
{
var x2 = (i+1) * canvas.clientWidth / samps;
var samp = parseInt( data.substr(i*2+2,2),16 );
var y2 = ( 1.-mult*samp / 255 ) * canvas.clientHeight;
var y2 = ( 0.5 - mult* (samp / 255 - 0.33) ) * canvas.clientHeight;

if( i == 0 )
{
var x1 = i * canvas.clientWidth / samps;
var y1 = ( 1.-mult*lastsamp / 255 ) * canvas.clientHeight;
var y1 = ( 0.5 - mult* (lastsamp / 255 - 0.33) ) * canvas.clientHeight;
ctx.moveTo( x1, y1 );
}

Expand Down Expand Up @@ -349,7 +349,7 @@ function GotNotes(req,data)

var elems = Number(secs[1] );

ctx.canvas.width = 400;
ctx.canvas.width = 600;
ctx.canvas.height = elems*25;


Expand All @@ -367,24 +367,26 @@ function GotNotes(req,data)
var amped2 = parseInt( data.substr(i*12+6,4),16 );
var jump = parseInt( data.substr(i*12+10,2),16 );

ctx.fillStyle = "#ffffff";
ctx.fillText( i+1, 0, i*25 + 20 );

if( peak == 255 )
{
ctx.fillStyle = "#ffffff";
ctx.fillText( jump, 10, i*25 + 20 );
ctx.fillText( jump, 60, i*25 + 20 );
continue;
}

ctx.fillStyle = CCColorDetail( peak );
ctx.lineWidth = 0;
ctx.fillRect( 0, i*25, 100,25);
ctx.fillRect( 101, i*25, amped/200,25);
ctx.fillRect( 229, i*25, amped2/200,25);
ctx.fillRect( 100, i*25, 50,25);
ctx.fillRect( 201, i*25, amped/20,25);
ctx.fillRect( 329, i*25, amped2/20,25);

ctx.fillStyle = "#000000";
ctx.fillText( peak, 10, i*25 + 20 );
ctx.fillStyle = "#ffffff";
ctx.fillText( amped, 121, i*25 + 20 );
ctx.fillText( amped2, 240, i*25 + 20 );
ctx.fillText( peak, 110, i*25 + 20 );
ctx.fillText( amped, 221, i*25 + 20 );
ctx.fillText( amped2, 340, i*25 + 20 );
}

var samp = parseInt( data.substr(i*2,2),16 );
Expand Down
Loading