Hi! Thanks for the update. Sadly it seems that even with two buttons the arduino cc lib still busts through the memory limit on the diecemilla, thought it does seem to compile with a single one:
Global variables use 1012 bytes (98%) of dynamic memory, leaving 12 bytes for local variables. Maximum is 1024 bytes.
For you to reproduce, here is my sketch:
#include<Arduino.h>
#include <ControlChain.h>
ControlChain control_chain;
const int buttonPinBase = 3;
const int numberOfButtons = 1;
int lastButtonState[numberOfButtons] = { LOW };//, LOW, LOW};//, LOW};//, LOW };
float controlState[numberOfButtons] = { 0};//, 0, 0};//, 0};//, 0 };
cc_actuator_config_t cc_actuator_configs[numberOfButtons];
void setup()
{
control_chain.init();
const char *uri = "https://nu.fps.io/mod_button_box_hack";
cc_device_t *device = control_chain.newDevice("ModButtonBoxHack", uri);
// We use INPUT_PULLUP to use the included pullup resistors
// in the microcontroller
for (int button = 0; button < numberOfButtons; ++button)
{
pinMode(buttonPinBase + button, INPUT_PULLUP);
cc_actuator_configs[button].type = CC_ACTUATOR_MOMENTARY;
cc_actuator_configs[button].name = "Button";
cc_actuator_configs[button].value = &controlState[button];
cc_actuator_configs[button].min = 0.0;
cc_actuator_configs[button].max = 1.0;
cc_actuator_configs[button].supported_modes = CC_MODE_TOGGLE | CC_MODE_TRIGGER;
cc_actuator_configs[button].max_assignments = 1;
cc_actuator_t *actuator;
actuator = control_chain.newActuator(&cc_actuator_configs[button]);
control_chain.addActuator(device, actuator);
}
}
void loop() {
for (int button = 0; button < numberOfButtons; ++button)
{
int state = digitalRead(buttonPinBase + button);
// Detect state transitions
if (state != lastButtonState[button])
{
// Going from low to high (on push)
if (state == HIGH)
{
controlState[button] = 1;
}
else
{
controlState[button] = 0;
}
}
// Store away the current state for the transition detection
lastButtonState[button] = state;
}
// Delay a couple of millisecs to avoid rapid firing while closing/opening a switch
delay(10);
}
Itās not yet tested since I never got to deploy it to the device, but it should be enough to debug the memory constraints.
@Codeman Iāll see if I can reproduce the firefox issue.
Regarding the control chain devices, try running the mod-ui on the console.
SSH into the mod and run this:
systemctl stop mod-ui
mod-ui.run
With the arduino connected, it should print these messages:
@fps thanks for the feedback. FYI, the Arduino library is using a generic library which implements the Control Chain layer (cc-slave). Iām developing it upon an ARM which is used for the footswitch extension. Iāve to say Iām quite comfortable in the matter of RAM and Flash memory, for this reason the cc-slave is a bit bloated when you bring it to Arduino 8-bit boards. On the other hand Arduinos as Diecimila, which has a humble amount of RAM, might require a specific implementation in order to reduce the use of resources to the minimum possible. While this is not happening Iāll check what else configuration I can make available to be adjusted.
iām not getting into the whole control chain thing, but i did play a show last night with build 346 (including a few unstable plugins), and everything went swimmingly.
earlier, while editing my pedalboard, i got some wierd transparent-looking plugins in the browser UI, but i think that was just due to something misbehaving in the pedalboard chain, because when i made a fresh board with those same plugins, it was all ok.
ā¦seems like sometimes things get wierd after some amount of adding/deleting/re-patching/re-assigning in a complicated pedalboard, but this is something iāve seen for quite a while now. sorry āthings get wierdā is not very helpful, but itās really hard to pin down what causes the problems in that scenario.
but that IS the first time iāve seen (temporary) transparent-looking plugin GUIs. fwiwā¦ (N.B. that might have been in the build just before 346ā¦ it was a mad flurry of building, pre-gig, and i updated to 346 towards the end, once i had settled on a simpler setup).
[ warning: comment_so_vague_as_to_be_useless ā> ] overall, my impression so far of 346 is similar to that magical, smooth feeling iāve had from time to time when a particularly splendid rt-patched-kernel comes along.
add a ā(i)ā icon on top of the plugin guis, clicking on it will show the plugin information dialog (same one used when clicking on the bottom plugin bar)
@Codeman Have a look at /etc/udev/rules.d/60-arduino.rules, maybe your device doesnāt trigger that rule?
Adding a manual symlink of /dev/ttyUSB0 to /dev/arduino might workā¦
@falkTX iām also having the āchecking file | invalid fileā loop on firefox in Ubuntu. iāll go try google chromeā¦
ā¦and, yes, itās fine in chrome.
Iām too lazy to look into the javascript code doing the update, but I suspect automatic decompression of the downloaded file performed by firefox making the subsequent file hash check fail. @falkTX
Will check this soon - sounds plausible for this problemā¦ My Arduinos have several USB-IDsā¦ even the āsame typeā of Arduino. Seems to be different if it is an original or china-ware.
Iāve updated the Arduino library. The new release have bugs fixes and reduce the RAM memory usage. @fps now the build for diecemilla is generating a binary with 71% of RAM usage, you should be able to use it now.
@AndyCap please try this last version and let me know if it fix your issues.
The new version of the Arduino library requires the build 364.