Fixed Issue: emptyQueue in Hub was not filled correctly
This commit is contained in:
@@ -14,4 +14,6 @@
|
||||
#define BUTTON_PIN 17
|
||||
|
||||
#define INTERRUPTION_DURATION ((int)(2.5 * 1000))
|
||||
#define INTERRUPTION_DELAY 5 * 1000
|
||||
#define INTERRUPTION_DELAY 5 * 1000
|
||||
|
||||
#define I2C_ADDR 0x21
|
||||
@@ -37,6 +37,18 @@ void onRxPackage(void * args, char *data, uint16_t len, GobotRPCTypes type, Gobo
|
||||
break;
|
||||
}
|
||||
|
||||
case GobotRPCNumber::GET_INFO: {
|
||||
InfoData info = appData->gobotrpc_ni->getInfo();
|
||||
txBuffer[0] = (info.addr >> 24) & 0xFF;
|
||||
txBuffer[1] = (info.addr >> 16) & 0xFF;
|
||||
txBuffer[2] = (info.addr >> 8) & 0xFF;
|
||||
txBuffer[3] = info.addr & 0xFF;
|
||||
txBuffer[4] = info.type;
|
||||
|
||||
g_appData.gobotrpc_ni->sendPackage(txBuffer, 5, GobotRPCTypes::RESPONSE, GobotRPCNumber::GET_INFO);
|
||||
break;
|
||||
}
|
||||
|
||||
case GobotRPCNumber::RESET: {
|
||||
softwareReset();
|
||||
break;
|
||||
@@ -52,7 +64,7 @@ void core1_main(void *pvParameters) {
|
||||
AppData * appData = (AppData *) pvParameters;
|
||||
GobotRPC_NI_Hardware_RP2040_I2C gobotrpc_ni_hardware(
|
||||
appData->txQueue, appData->rxQueue, CORE_MASK_VACUM,
|
||||
i2c0, 0x21, GORPC_SDA_PIN, GORPC_SCL_PIN, GORPC_INT_PIN
|
||||
i2c0, I2C_ADDR, GORPC_SDA_PIN, GORPC_SCL_PIN, GORPC_INT_PIN
|
||||
);
|
||||
|
||||
while (true) {
|
||||
@@ -85,7 +97,9 @@ int main() {
|
||||
vacumControl.setState(false);
|
||||
g_appData.vacumControl = &vacumControl;
|
||||
|
||||
GobotRPC_NI gobotrpc_ni(CORE_MASK_VACUM, g_appData.txQueue, g_appData.rxQueue);
|
||||
InfoData info = {.addr=I2C_ADDR, .type=NODE_TYPE_VACUM};
|
||||
|
||||
GobotRPC_NI gobotrpc_ni(CORE_MASK_VACUM, g_appData.txQueue, g_appData.rxQueue, info);
|
||||
gobotrpc_ni.registerOnPackageRxCallback(onRxPackage, &g_appData);
|
||||
|
||||
g_appData.gobotrpc_ni = &gobotrpc_ni;
|
||||
|
||||
Reference in New Issue
Block a user