mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-13 21:55:59 +08:00
Add more data in ESP420 for USB Port when connected
This commit is contained in:
parent
9f303ca3ee
commit
b892b3f909
@ -240,6 +240,15 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (esp3d_usb_serial_service.isConnected()) {
|
||||
tmpstr = esp3d_usb_serial_service.getVIDString();
|
||||
tmpstr += ":";
|
||||
tmpstr += esp3d_usb_serial_service.getPIDString();
|
||||
if (!dispatchIdValue(json, "Vid/Pid", tmpstr.c_str(), target, requestId,
|
||||
false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // defined(USB_SERIAL_FEATURE)
|
||||
|
||||
#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
|
@ -255,6 +255,32 @@ void ESP3DUsbSerialService::connectDevice() {
|
||||
}
|
||||
}
|
||||
|
||||
const char *ESP3DUsbSerialService::getVIDString() {
|
||||
if (_vcp_ptr && _is_connected) {
|
||||
return esp_usb::getVIDString();
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
const char *ESP3DUsbSerialService::getPIDString() {
|
||||
if (_vcp_ptr && _is_connected) {
|
||||
return esp_usb::getPIDString();
|
||||
}
|
||||
return "None";
|
||||
}
|
||||
|
||||
uint16_t ESP3DUsbSerialService::getVID() {
|
||||
if (_vcp_ptr && _is_connected) {
|
||||
return esp_usb::getVID();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint16_t ESP3DUsbSerialService::getPID() {
|
||||
if (_vcp_ptr && _is_connected) {
|
||||
return esp_usb::getPID();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Setup Serial
|
||||
bool ESP3DUsbSerialService::begin() {
|
||||
_buffer_mutex = xSemaphoreCreateMutex();
|
||||
|
@ -56,6 +56,11 @@ class ESP3DUsbSerialService final {
|
||||
void connectDevice();
|
||||
void setConnected(bool connected);
|
||||
void receiveCb(const uint8_t *data, size_t data_len, void *arg = nullptr);
|
||||
bool isConnected() { return _is_connected; }
|
||||
const char * getVIDString();
|
||||
const char * getPIDString();
|
||||
uint16_t getVID();
|
||||
uint16_t getPID();
|
||||
|
||||
private:
|
||||
uint32_t _baudRate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user