fix: update createdVendorId reset value to 65535 for improved API handling
This commit is contained in:
@@ -618,7 +618,7 @@ uint16_t createVendor(String vendor) {
|
|||||||
// Create new vendor in Spoolman database using task system
|
// Create new vendor in Spoolman database using task system
|
||||||
// Note: Due to async nature, the ID will be stored in createdVendorId global variable
|
// Note: Due to async nature, the ID will be stored in createdVendorId global variable
|
||||||
// Note: This function assumes that the caller has already ensured API is IDLE
|
// Note: This function assumes that the caller has already ensured API is IDLE
|
||||||
createdVendorId = 0; // Reset previous value
|
createdVendorId = 65535; // Reset previous value
|
||||||
|
|
||||||
String spoolsUrl = spoolmanUrl + apiUrl + "/vendor";
|
String spoolsUrl = spoolmanUrl + apiUrl + "/vendor";
|
||||||
Serial.print("Create vendor with URL: ");
|
Serial.print("Create vendor with URL: ");
|
||||||
@@ -668,8 +668,8 @@ uint16_t createVendor(String vendor) {
|
|||||||
|
|
||||||
// Wait for task completion and return the created vendor ID
|
// Wait for task completion and return the created vendor ID
|
||||||
// Note: createdVendorId will be set by sendToApi when response is received
|
// Note: createdVendorId will be set by sendToApi when response is received
|
||||||
while(spoolmanApiState != API_IDLE) {
|
while(createdVendorId == 65535) {
|
||||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createdVendorId;
|
return createdVendorId;
|
||||||
|
Reference in New Issue
Block a user