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

Move prefix/port messages from on-detection to on-connection #197

Merged
merged 3 commits into from
Oct 7, 2024
Merged
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
3 changes: 1 addition & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
"env": {
"PATH": "C:\\msys64\\usr\\bin;c:\\msys64\\mingw64\\bin",
"MSYSTEM": "MINGW64",
"CC": "gcc",
"RACK_USER_DIR": "${OneDrive}\\Documents\\Rack2"
"CC": "gcc"
},
"shell": {
"executable": "C:\\msys64\\usr\\bin\\bash.exe",
Expand Down
6 changes: 3 additions & 3 deletions firmware/mock_hardware/common/ftdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ u8* ftdi_rx_buf(void)
return 0;
}

u8 ftdi_rx_bytes(void)
volatile u8 ftdi_rx_bytes(void)
{
return 0;
}

u8 ftdi_rx_busy(void) { return 0; }
u8 ftdi_tx_busy(void) { return 0; }
volatile u8 ftdi_rx_busy(void) { return 0; }
volatile u8 ftdi_tx_busy(void) { return 0; }

u8 ftdi_connected(void)
{
Expand Down
6 changes: 3 additions & 3 deletions firmware/mock_hardware/include/ftdi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void ftdi_change(uhc_device_t* dev, u8 plug);
void ftdi_setup(void);

u8* ftdi_rx_buf(void);
u8 ftdi_rx_bytes(void);
u8 ftdi_rx_busy(void);
u8 ftdi_tx_busy(void);
volatile u8 ftdi_rx_bytes(void);
volatile u8 ftdi_rx_busy(void);
volatile u8 ftdi_tx_busy(void);
u8 ftdi_connected(void);
2 changes: 1 addition & 1 deletion firmware/mock_hardware/mock_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ u8* mock_serial_rx_buf(void)
return mock_serial_current_message_buffer;
}

u8 mock_serial_rx_bytes(void)
volatile u8 mock_serial_rx_bytes(void)
{
return mock_serial_current_message_length;
}
Expand Down
2 changes: 1 addition & 1 deletion firmware/whitewhale-kria
Submodule whitewhale-kria updated 1 files
+3 −3 src/main.c
3 changes: 0 additions & 3 deletions lib/serialosc/SerialOsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,6 @@ void SerialOsc::ProcessMessage(const osc::ReceivedMessage& m, const IpEndpointNa
// wait until after size message recieved -MD
// listener->deviceFound(device);
sendDeviceInfoMessage(device->port);

sendDevicePrefixMessage(port);
sendDevicePortMessage(port);
}
else if (address == "/serialosc/remove")
{
Expand Down
10 changes: 10 additions & 0 deletions src/common/core/GridConnection/GridConnection.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "GridConnection.hpp"
#include "SerialOscInterface.hpp"

void GridConnectionManager::registerGrid(Grid* grid)
{
Expand Down Expand Up @@ -76,6 +77,15 @@ void GridConnectionManager::connect(Grid* grid, IGridConsumer* consumer)
consumerToGridMap[consumer] = grid;
idToConsumerMap[grid->getDevice().id] = consumer;
consumer->gridConnected(grid);

// If serialosc is managing the grid (e.g. it's a hardware grid), inform serialosc about new grid owner
auto port = grid->getDevice().port;
auto so = SerialOscInterface::get();
if (port > 0 && so != nullptr && so->driver != nullptr)
{
so->driver->sendDevicePrefixMessage(port);
so->driver->sendDevicePortMessage(port);
}
}

bool GridConnectionManager::isConnected(IGridConsumer* consumer)
Expand Down
Loading