- Fix the casting issue with setCamera
- Fix the linker undefined error with setCameraConfig
This commit is contained in:
ZanzyTHEbar 2022-09-01 23:00:02 +01:00
parent 9726e51446
commit d965ac466b
2 changed files with 22 additions and 11 deletions

View File

@ -179,6 +179,19 @@ void ProjectConfig::setDeviceConfig(const std::string &name, const std::string &
this->notify(ObserverEvent::deviceConfigUpdated);
}
void ProjectConfig::setCameraConfig(uint8_t *vflip, uint8_t *framesize, uint8_t *href, uint8_t *quality, bool shouldNotify)
{
log_d("Updating camera config");
this->config.camera.vflip = *vflip;
this->config.camera.framesize = *framesize;
this->config.camera.href = *href;
this->config.camera.quality = *quality;
log_d("Updating Camera config");
if (shouldNotify)
this->notify(ObserverEvent::networksConfigUpdated);
}
void ProjectConfig::setWifiConfig(const std::string &networkName, const std::string &ssid, const std::string &password, uint8_t *channel, bool adhoc, bool shouldNotify)
{
WiFiConfig_t *networkToUpdate = nullptr;

View File

@ -262,10 +262,10 @@ void BaseAPI::setCamera(AsyncWebServerRequest *request)
case GET:
{
// create temporary variables to store the values
int temp_camera_framesize = 0;
int temp_camera_vflip = 0;
int temp_camera_hflip = 0;
int temp_camera_quality = 0;
uint8_t temp_camera_framesize = 0;
uint8_t temp_camera_vflip = 0;
uint8_t temp_camera_hflip = 0;
uint8_t temp_camera_quality = 0;
int params = request->params();
for (int i = 0; i < params; i++)
@ -273,19 +273,19 @@ void BaseAPI::setCamera(AsyncWebServerRequest *request)
AsyncWebParameter *param = request->getParam(i);
if (param->name() == "framesize")
{
temp_camera_framesize = param->value().toInt();
temp_camera_framesize = (uint8_t)param->value().toInt();
}
else if (param->name() == "vflip")
{
temp_camera_vflip = param->value().toInt();
temp_camera_vflip = (uint8_t)param->value().toInt();
}
else if (param->name() == "hflip")
{
temp_camera_hflip = param->value().toInt();
temp_camera_hflip = (uint8_t)param->value().toInt();
}
else if (param->name() == "quality")
{
temp_camera_quality = param->value().toInt();
temp_camera_quality = (uint8_t)param->value().toInt();
}
}
@ -295,11 +295,9 @@ void BaseAPI::setCamera(AsyncWebServerRequest *request)
camera->setHFlip(temp_camera_hflip);
//! TODO: Need to add -> camera->setQuality(temp_camera_quality);
network->configManager->setCameraConfig((uint8_t *)temp_camera_vflip, (uint8_t *)temp_camera_framesize, (uint8_t *)temp_camera_hflip, (uint8_t *)temp_camera_quality, true);
network->configManager->setCameraConfig(&temp_camera_vflip, &temp_camera_framesize, &temp_camera_hflip, &temp_camera_quality, true);
network->configManager->cameraConfigSave();
request->send(200, MIMETYPE_JSON, "{\"msg\":\"Done. Camera Settings have been set.\"}");
break;
}