Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aggregat-02
a01-firmware
Commits
6dc7fcd2
Commit
6dc7fcd2
authored
Aug 21, 2020
by
philip
Browse files
cfg and button functionality
parent
e0e1849c
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
6dc7fcd2
...
...
@@ -12,13 +12,14 @@ https://aggregat.zhdk.ch/
-
[
] [mDNS / DNS-SD
](
https://github.com/tschiemer/minimr
)
based host/service discovery
-
[x] ~~using hardware id as part of hostname~~
-
[ ] ~~dynamic, simple hostname~~
-
[ ]
*Proposed*
Use Channel (or specific) setting as part of hostname, ex ch4.aggregat.local or 1.aggregat.local
-
[ ]
*Proposed*
Use Channel (or specific) setting as part of hostname, ex
ch4.aggregat.local or 1.aggregat.local
-
[ ] service???
-
[ ] Control interface TBD
1.
*Proposed*
Raw UDP (quasi simple) port (?): 1234 (?)
2.
[
OSC
](
https://github.com/MariadeAnton/oscpack
)
(
relatively
simple)
3.
*Postpone (when components are made by pt)*
RTPMIDI (complex)
## Installation / Flashing
1.
Connect the USB cable (programming end / opposite of ethernet plug) to computer.
...
...
@@ -85,6 +86,29 @@ or

| What | Function |
| --- | --- |
| Button left corner | Hard reset |
| 4-pin DIP Switch left | MIDI channel select (binary MSB-LSB) |
| 4-pin DIP Switch right | Device id select (binary MSB-LSB) |
| 8-pin DIP Switch: Pin 1 | Forward USBMIDI to MIDI? |
| 8-pin DIP Switch: Pin 2 | Forward USBMIDI to RTPMIDI? |
| 8-pin DIP Switch: Pin 3 | Forward MIDI to USBMIDI? |
| 8-pin DIP Switch: Pin 4 | Forward MIDI to RTPMIDI? |
| 8-pin DIP Switch: Pin 5 | Forward RTPMIDI to USBMIDI? |
| 8-pin DIP Switch: Pin 6 | Forward RTPMIDI to MIDI? |
| 8-pin DIP Switch: Pin 7 | HIGH -> Suspend motors on startup, LOW -> run motors |
| 8-pin DIP Switch: Pin 8 | Enable motor power control (MIDI commands are processed)
*currently feature not implemented in hardware*
|
| Three buttons left | Set all motors to center position |
| Three buttons middle |
*not implemented*
|
| Three buttons right | Suspend / Resume all motors |
| |
| Green LED left bottom | System has power |
| Red LED left top | Motors are either all suspended or at least one motor's power is off |
| LED
## Software
Use
[
Mbed Studio
](
https://os.mbed.com/studio/
)
as IDE.
...
...
main.cpp
View file @
6dc7fcd2
...
...
@@ -401,17 +401,26 @@ void motors_resume()
void
motors_run
()
{
if
(
btn_plus2_touched
){
if
(
motors_running
){
motors_suspend
();
}
else
{
motors_resume
();
}
btn_plus2_touched
=
false
;
}
if
(
motors_center_request
){
motors_center
();
motors_center_request
=
false
;
}
bool
is_off
=
!
motors_running
;
bool
is_off
=
motors_running
==
false
;
for
(
int
i
=
0
;
i
<
MOTOR_COUNT
;
i
++
){
motors
[
i
].
run
();
//
is_off |=
!
motors[i].get_state();
is_off
|=
motors
[
i
].
get_state
()
==
false
;
}
led_motors
=
is_off
;
...
...
@@ -491,15 +500,22 @@ void controller_handle_msg(uint8_t * buffer, size_t length, Source source)
#endif //USE_PITCHBEND_CONTROL
// power control
if
(
msg
.
type
()
==
MIDIMessage
::
NoteOnType
||
msg
.
type
()
==
MIDIMessage
::
NoteOffType
){
if
(
msg
.
channel
()
==
get_channel
()){
int32_t
motori
=
msg
.
key
();
if
(
0
<=
motori
&&
motori
<
MOTOR_COUNT
){
// turn on or off
bool
off
=
msg
.
type
()
==
MIDIMessage
::
NoteOffType
||
msg
.
velocity
()
==
0
;
// printf("motor pwr %d := %d\n", motori, !off);
motors
[
motori
]
=
!
off
;
#if USE_CFG
// only enable power pin iff cfg2 is enabled
if
(
cfg2
.
read
()){
#else
{
#endif
if
(
msg
.
type
()
==
MIDIMessage
::
NoteOnType
||
msg
.
type
()
==
MIDIMessage
::
NoteOffType
){
if
(
msg
.
channel
()
==
get_channel
()){
int32_t
motori
=
msg
.
key
();
if
(
0
<=
motori
&&
motori
<
MOTOR_COUNT
){
// turn on or off
bool
off
=
msg
.
type
()
==
MIDIMessage
::
NoteOffType
||
msg
.
velocity
()
==
0
;
// printf("motor pwr %d := %d\n", motori, !off);
motors
[
motori
]
=
!
off
;
}
}
}
}
...
...
@@ -1087,7 +1103,14 @@ int main()
netmidi_init
();
// start motors
// motors_resume();
#if USE_CFG
// if cfg1 is low, resume (all switches (default) low -> system should run without further ado)
if
(
!
cfg1
.
read
()){
motors_resume
();
}
#else
motors_resume
();
#endif //USE_CFG
while
(
true
)
{
usbmidi_run
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment