Skip to content

Commit 428d757

Browse files
optimized includes; implemented first unit tests of UART
#61
1 parent fc2f2ce commit 428d757

20 files changed

Lines changed: 195 additions & 319 deletions

src/adda.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "adda.h"
2626

27+
#include "adda-message.h"
28+
2729

2830
Adda::Adda(X32BaseParameter* basepar): X32Base(basepar) {
2931
SetMuteAll(true);

src/adda.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "types.h"
55
#include "../lib/WString.h"
66
#include "uart.h"
7-
#include "adda-message.h"
7+
88

99
#define ADDA_MAX_PACKET_LENGTH 32
1010
#define ADDA_MAX_BOARDS 8

src/artnet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "artnet.h"
2626

27+
#include "../lib/WString.h"
28+
2729
#if ENABLE_ARTNET
2830

2931

src/artnet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <stdint.h>
66

77
#include "defines.h"
8-
#include "../lib/WString.h"
98
#include "base.h"
109

1110
using namespace std;

src/ctrl.cpp

Lines changed: 38 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
22

33
#include "version.h"
44

5+
#include "external.h" // all external includes
6+
7+
#include "x32config.h"
8+
#include "helper.h"
9+
#include "state.h"
10+
#include "xremote.h"
11+
#include "wsm.h"
12+
13+
14+
15+
16+
#include "page-meters.h"
17+
#include "page-rta.h"
18+
#include "page-home.h"
19+
#include "page-config.h"
20+
#include "page-gate.h"
21+
#include "page-dynamics.h"
22+
#include "page-eq.h"
23+
#include "page-sends.h"
24+
#include "page-main.h"
25+
#include "page-routing.h"
26+
#include "page-routing-fpga.h"
27+
#include "page-routing-channels.h"
28+
#include "page-routing-dsp.h"
29+
#include "page-library.h"
30+
#include "page-effects.h"
31+
#include "page-setup.h"
32+
#include "page-setup-card.h"
33+
#include "page-setup-surface.h"
34+
#include "page-debug.h"
35+
#include "page-about.h"
36+
#include "page-scenes.h"
37+
#include "page-prototypegui.h"
38+
#include "lcd-menu.h"
39+
40+
#include "surfaceelement.h"
41+
#include "surfacebindingparameter.h"
42+
#include "surface-controller.h"
543

644
X32Ctrl::X32Ctrl(X32BaseParameter* basepar) : X32Base(basepar)
745
{
@@ -392,194 +430,6 @@ void X32Ctrl::ProcessUartDataAES50() {
392430
//#####################################################################################################################
393431

394432

395-
// receive data from XRemote client
396-
void X32Ctrl::UdpHandleCommunication(void) {
397-
char rxData[500];
398-
int bytes_available = 0;
399-
uint8_t channel;
400-
data_32b value32bit;
401-
402-
// check for bytes in UDP-buffer
403-
//int result = ioctl(xremote->UdpHandle, FIONREAD, &bytes_available);
404-
if (bytes_available > 0) {
405-
socklen_t xremoteClientAddrLen = sizeof(xremote->ClientAddr);
406-
uint8_t len = recvfrom(xremote->UdpHandle, rxData, bytes_available, MSG_WAITALL, (struct sockaddr *) &xremote->ClientAddr, &xremoteClientAddrLen);
407-
408-
tosc_message osc;
409-
410-
if (!tosc_parseMessage(&osc, rxData, len)) {
411-
string adrPath = string(tosc_getAddress(&osc));
412-
vector<string> address = helper->split(adrPath, "/");
413-
address.erase(address.begin()); // delete empty element
414-
string format = string(tosc_getFormat(&osc));
415-
416-
if (address[0] == "renew") {
417-
//fprintf(stdout, "Received command: %s\n", rxData);
418-
} else if (address[0] == "info") {
419-
xremote->AnswerInfo();
420-
} else if (address[0] == "xinfo") {
421-
xremote->AnswerXInfo();
422-
} else if (address[0] == "status") {
423-
xremote->AnswerStatus();
424-
} else if (address[0] == "xremote") {
425-
// Optional: read and store IP-Address of client
426-
//xremoteSync(true);
427-
} else if (address[0] == "unsubscribe") {
428-
// Optional: remove xremote client
429-
} else if (address[0] == "ch") {
430-
// /ch/xx/mix/fader~~~~,f~~[float]
431-
// /ch/xx/mix/pan~~,f~~[float]
432-
// /ch/xx/mix/on~~~,i~~[int]
433-
434-
//channel = ((rxData[4]-48)*10 + (rxData[5]-48)) - 1;
435-
channel = stoi(address[1]);
436-
437-
if (address[2] == "mix") {
438-
if (address[3] == "fader") {
439-
float newVolume = tosc_getNextFloat(&osc);
440-
//mixer->SetVolumeOscvalue(channel-1, newVolume);
441-
helper->DEBUG_XREMOTE(DEBUGLEVEL_VERBOSE, "Ch %u: Volume set to %f\n", channel, (double)newVolume);
442-
}else if (address[3] == "pan") {
443-
// get pan-value
444-
value32bit.u8[0] = rxData[23];
445-
value32bit.u8[1] = rxData[22];
446-
value32bit.u8[2] = rxData[21];
447-
value32bit.u8[3] = rxData[20];
448-
449-
//encoderValue = value32bit.f * 255.0f;
450-
//mixer->SetBalance(channel, value32bit.f * 100.0f);
451-
helper->DEBUG_XREMOTE(DEBUGLEVEL_VERBOSE, "Ch %u: Balance set to %f\n", channel+1, (double)(value32bit.f * 100.0f));
452-
}else if (address[3] == "on") {
453-
// get mute-state (caution: here it is "mixer-on"-state)
454-
//mixer->SetMute(channel, (rxData[20+3] == 0));
455-
helper->DEBUG_XREMOTE(DEBUGLEVEL_VERBOSE, "Ch %u: Mute set to %u\n", channel+1, (rxData[20+3] == 0));
456-
}
457-
}else if ((rxData[7] == 'c') && (rxData[8] == 'o') && (rxData[9] == 'n')) {
458-
// config
459-
if ((rxData[14] == 'c') && (rxData[15] == 'o') && (rxData[16] == 'l')) {
460-
// color
461-
value32bit.u8[0] = rxData[27];
462-
value32bit.u8[1] = rxData[26];
463-
value32bit.u8[2] = rxData[25];
464-
value32bit.u8[3] = rxData[24];
465-
466-
if (value32bit.u32 < 8) {
467-
//fprintf(stdout, "Ch %u: Set color to %u\n", channel+1, value32bit.u32);
468-
}else{
469-
//fprintf(stdout, "Ch %u: Set inverted color to %u\n", channel+1, value32bit.u32 - 8 +64);
470-
}
471-
}else if ((rxData[14] == 'n') && (rxData[15] == 'a') && (rxData[16] == 'm')) {
472-
// name
473-
String name = String(&rxData[24]);
474-
//fprintf(stdout, "Ch %u: Set name to %s\n", channel+1, name.c_str());
475-
}else if ((rxData[14] == 'i') && (rxData[15] == 'c') && (rxData[16] == 'o')) {
476-
// icon
477-
value32bit.u8[0] = rxData[27];
478-
value32bit.u8[1] = rxData[26];
479-
value32bit.u8[2] = rxData[25];
480-
value32bit.u8[3] = rxData[24];
481-
482-
// do something with channel and value32bit.f
483-
//Serial.println("/ch/" + String(channel) + "/config/icon " + String(value32bit.u32));
484-
//fprintf(stdout, "Ch %u: Set icon to %u\n", channel+1, value32bit.u32);
485-
}
486-
}
487-
} else if (address[0] == "main") {
488-
// /main/st/mix/fader~~,f~~[float]
489-
// /main/st/mix/pan~~~~,f~~[float]
490-
// /main/st/mix/on~,i~~[int]
491-
if (len > 12) {
492-
if ((rxData[6] == 's') && (rxData[7] == 't') && (rxData[9] == 'm') && (rxData[10] == 'i') && (rxData[11] == 'x')) {
493-
if ((rxData[13] == 'f') && (rxData[14] == 'a') && (rxData[15] == 'd')) {
494-
// get fader-value
495-
value32bit.u8[0] = rxData[27];
496-
value32bit.u8[1] = rxData[26];
497-
value32bit.u8[2] = rxData[25];
498-
value32bit.u8[3] = rxData[24];
499-
500-
//float newVolume = (value32bit.f * 54.0f) - 48.0f;
501-
//mixerSetMainVolume(newVolume);
502-
}else if ((rxData[13] == 'p') && (rxData[14] == 'a') && (rxData[15] == 'n')) {
503-
// get pan-value
504-
value32bit.u8[0] = rxData[27];
505-
value32bit.u8[1] = rxData[26];
506-
value32bit.u8[2] = rxData[25];
507-
value32bit.u8[3] = rxData[24];
508-
509-
//mixerSetMainBalance(value32bit.f * 100);
510-
}else if ((rxData[13] == 'o') && (rxData[14] == 'n')) {
511-
// get mute-state
512-
// /main/st/mix/on~,i~~~
513-
// do something with channel and (rxData[20+3]) // 0 = mute off, 31 = mute on
514-
}
515-
}
516-
}
517-
}else if (memcmp(rxData, "/-st", 4) == 0) {
518-
// stat
519-
520-
if ((rxData[7] == 's') && (rxData[8] == 'o') && (rxData[9] == 'l') && (rxData[10] == 'o') && (rxData[11] == 's') && (rxData[12] == 'w')) {
521-
// /-stat/solosw/xx~~~~,i~~[integer]
522-
channel = ((rxData[14]-48)*10 + (rxData[15]-48)) - 1;
523-
value32bit.u8[0] = rxData[27];
524-
value32bit.u8[1] = rxData[26];
525-
value32bit.u8[2] = rxData[25];
526-
value32bit.u8[3] = rxData[24];
527-
528-
// we receive solo-values for 80 channels
529-
/*
530-
if (channel < 32) {
531-
mixerSetSolo(channel, (value32bit.u32 == 1));
532-
}
533-
*/
534-
}else if ((rxData[7] == 'u') && (rxData[8] == 'r') && (rxData[9] == 'e') && (rxData[10] == 'c')) {
535-
value32bit.u8[0] = rxData[27];
536-
value32bit.u8[1] = rxData[26];
537-
value32bit.u8[2] = rxData[25];
538-
value32bit.u8[3] = rxData[24];
539-
540-
// /-stat/urec/state~~~,i~~[integer]
541-
if (value32bit.u32 == 0) {
542-
// stop
543-
}else if (value32bit.u32 == 1) {
544-
// pause
545-
}else if (value32bit.u32 == 2) {
546-
// play
547-
}else if (value32bit.u32 == 3) {
548-
// record
549-
}
550-
}
551-
552-
//fprintf(stdout, "Received command: %s\n", rxData);
553-
}else if (memcmp(rxData, "/bat", 4) == 0) {
554-
}else if (memcmp(rxData, "/ren", 4) == 0) {
555-
}else if (memcmp(rxData, "/for", 4) == 0) {
556-
}else{
557-
//xremote->AnswerAny();
558-
// ignore unused commands for now
559-
//fprintf(stdout, "Received unsupported command: %s\n", rxData);
560-
}
561-
}else{
562-
//fprintf(stdout, "Caution: len <= 0");
563-
}
564-
565-
566-
567-
// tosc_getFormat(&osc)); // the OSC format string, e.g. "f"
568-
// for (int i = 0; osc.format[i] != '\0'; i++) {
569-
// switch (osc.format[i]) {
570-
// case 'f': printf("%g ", tosc_getNextFloat(&osc)); break;
571-
// case 'i': printf("%i ", tosc_getNextInt32(&osc)); break;
572-
// // returns NULL if the buffer length is exceeded
573-
// case 's': printf("%s ", tosc_getNextString(&osc)); break;
574-
// default: continue;
575-
// }
576-
// }
577-
// printf("\n");
578-
}
579-
580-
581-
}
582-
583433
// receive data from WSM client
584434
void X32Ctrl::UdpHandleCommunication_WSM()
585435
{

src/ctrl.h

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,14 @@
11
#pragma once
22

3-
#include "external.h" // all external includes
4-
5-
#include "x32config.h"
6-
#include "helper.h"
7-
#include "state.h"
83
#include "mixer.h"
4+
#include "surface.h"
95
#include "xremote.h"
106
#include "wsm.h"
11-
7+
#include "lcd-menu.h"
128
#if ENABLE_ARTNET
139
#include "artnet.h"
1410
#endif
15-
16-
17-
#include "page-meters.h"
18-
#include "page-rta.h"
19-
#include "page-home.h"
20-
#include "page-config.h"
21-
#include "page-gate.h"
22-
#include "page-dynamics.h"
23-
#include "page-eq.h"
24-
#include "page-sends.h"
25-
#include "page-main.h"
26-
#include "page-routing.h"
27-
#include "page-routing-fpga.h"
28-
#include "page-routing-channels.h"
29-
#include "page-routing-dsp.h"
30-
#include "page-library.h"
31-
#include "page-effects.h"
32-
#include "page-setup.h"
33-
#include "page-setup-card.h"
34-
#include "page-setup-surface.h"
35-
#include "page-debug.h"
36-
#include "page-about.h"
37-
#include "page-scenes.h"
38-
#include "page-prototypegui.h"
39-
#include "lcd-menu.h"
40-
41-
#include "surfaceelement.h"
42-
#include "surfacebindingparameter.h"
43-
#include "surface-controller.h"
44-
45-
// Commandline and config file parser CLI11 (https://github.com/CLIUtils/CLI11)
46-
#include "../lib/CLI11.hpp"
47-
48-
// includes for lvgl
49-
//#include "../lib/lv_port_linux/lvgl/lvgl.h"
50-
//#include "../lib/lv_port_linux/src/lib/backends.h"
51-
//#include "../lib/lv_port_linux/src/lib/driver_backends.h"
52-
53-
// including the GUI built by EEZ-Studio
54-
#include "eez/actions.h"
55-
#include "eez/fonts.h"
56-
#include "eez/images.h"
57-
#include "eez/screens.h"
58-
#include "eez/structs.h"
59-
#include "eez/styles.h"
60-
#include "eez/ui.h"
61-
#include "eez/vars.h"
62-
63-
#include "../lib/tinyosc.h"
11+
#include "page.h"
6412

6513
using namespace std;
6614

src/dsp1.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "dsp1.h"
2626

27+
#include "const.h"
28+
2729
DSP1::DSP1(X32BaseParameter* basepar) : X32Base(basepar)
2830
{
2931
spi = new SPI(basepar);

src/dsp1.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#pragma once
22

3-
#include "external.h"
43
#include "types.h"
5-
#include "const.h"
6-
74
#include "base.h"
85
#include "spi.h"
96
#include "fxmath.h"
7+
#include "fxslot.h"
108

119
class DSP1 : X32Base {
1210

src/external.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,4 @@
1818

1919
// includes for timer
2020
#include <time.h>
21-
// #include <signal.h>
2221

23-
// includes for lvgl
24-
//#include "../build/lib_ext/lvgl/lvgl.h"
25-
//#include "../lib/lv_port_linux/src/lib/backends.h"
26-
//#include "../lib/lv_port_linux/src/lib/driver_backends.h"
27-
28-
// includes for GLAZE
29-
//#include "glaze/glaze.hpp"

src/fxmath.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#pragma once
22

3-
#include <math.h>
4-
53
#include "base.h"
6-
#include "defines.h"
7-
8-
#include "fxslot.h"
94

105
class FxMath : X32Base {
116

0 commit comments

Comments
 (0)