Skip to content

Commit

Permalink
Code translation (#1626)
Browse files Browse the repository at this point in the history
* comment translation

* translation part #2

* code translation from DE to ENG #part3

* translation #4

* dismantled =>splitted

* bereich => range

* Update defines.h

Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
  • Loading branch information
nliaudat and jomjol authored Dec 19, 2022
1 parent 67ff06f commit f6369ff
Show file tree
Hide file tree
Showing 31 changed files with 686 additions and 750 deletions.
2 changes: 1 addition & 1 deletion code/components/jomjol_configfile/configFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool ConfigFile::getNextLine(std::string *rt, bool &disabled, bool &eof)
}
*rt = zw;
*rt = trim(*rt);
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '[')) // Kommentarzeilen (; oder #) und Leerzeilen überspringen, es sei denn es ist ein neuer auskommentierter Paragraph
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '['))
{
fgets(zw, 1024, pFile);
ESP_LOGD(TAG, "%s", zw);
Expand Down
54 changes: 27 additions & 27 deletions code/components/jomjol_controlGPIO/server_GPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ bool GpioHandler::readConfig()

ConfigFile configFile = ConfigFile(_configFile);

std::vector<std::string> zerlegt;
std::vector<std::string> splitted;
std::string line = "";
bool disabledLine = false;
bool eof = false;
Expand Down Expand Up @@ -340,31 +340,31 @@ bool GpioHandler::readConfig()
bool registerISR = false;
while (configFile.getNextLine(&line, disabledLine, eof) && !configFile.isNewParagraph(line))
{
zerlegt = ZerlegeZeile(line);
splitted = ZerlegeZeile(line);
// const std::regex pieces_regex("IO([0-9]{1,2})");
// std::smatch pieces_match;
// if (std::regex_match(zerlegt[0], pieces_match, pieces_regex) && (pieces_match.size() == 2))
// if (std::regex_match(splitted[0], pieces_match, pieces_regex) && (pieces_match.size() == 2))
// {
// std::string gpioStr = pieces_match[1];
ESP_LOGD(TAG, "conf param %s", toUpper(zerlegt[0]).c_str());
if (toUpper(zerlegt[0]) == "MAINTOPICMQTT") {
ESP_LOGD(TAG, "conf param %s", toUpper(splitted[0]).c_str());
if (toUpper(splitted[0]) == "MAINTOPICMQTT") {
// ESP_LOGD(TAG, "MAINTOPICMQTT found");
// mainTopicMQTT = zerlegt[1];
} else if ((zerlegt[0].rfind("IO", 0) == 0) && (zerlegt.size() >= 6))
// mainTopicMQTT = splitted[1];
} else if ((splitted[0].rfind("IO", 0) == 0) && (splitted.size() >= 6))
{
ESP_LOGI(TAG,"Enable GP%s in %s mode", zerlegt[0].c_str(), zerlegt[1].c_str());
std::string gpioStr = zerlegt[0].substr(2, 2);
ESP_LOGI(TAG,"Enable GP%s in %s mode", splitted[0].c_str(), splitted[1].c_str());
std::string gpioStr = splitted[0].substr(2, 2);
gpio_num_t gpioNr = (gpio_num_t)atoi(gpioStr.c_str());
gpio_pin_mode_t pinMode = resolvePinMode(toLower(zerlegt[1]));
gpio_int_type_t intType = resolveIntType(toLower(zerlegt[2]));
uint16_t dutyResolution = (uint8_t)atoi(zerlegt[3].c_str());
gpio_pin_mode_t pinMode = resolvePinMode(toLower(splitted[1]));
gpio_int_type_t intType = resolveIntType(toLower(splitted[2]));
uint16_t dutyResolution = (uint8_t)atoi(splitted[3].c_str());
#ifdef ENABLE_MQTT
bool mqttEnabled = toLower(zerlegt[4]) == "true";
bool mqttEnabled = toLower(splitted[4]) == "true";
#endif // ENABLE_MQTT
bool httpEnabled = toLower(zerlegt[5]) == "true";
bool httpEnabled = toLower(splitted[5]) == "true";
char gpioName[100];
if (zerlegt.size() >= 7) {
strcpy(gpioName, trim(zerlegt[6]).c_str());
if (splitted.size() >= 7) {
strcpy(gpioName, trim(splitted[6]).c_str());
} else {
sprintf(gpioName, "GPIO%d", gpioNr);
}
Expand All @@ -386,28 +386,28 @@ bool GpioHandler::readConfig()
registerISR = true;
}
}
if (toUpper(zerlegt[0]) == "LEDNUMBERS")
if (toUpper(splitted[0]) == "LEDNUMBERS")
{
LEDNumbers = stoi(zerlegt[1]);
LEDNumbers = stoi(splitted[1]);
}
if (toUpper(zerlegt[0]) == "LEDCOLOR")
if (toUpper(splitted[0]) == "LEDCOLOR")
{
uint8_t _r, _g, _b;
_r = stoi(zerlegt[1]);
_g = stoi(zerlegt[2]);
_b = stoi(zerlegt[3]);
_r = stoi(splitted[1]);
_g = stoi(splitted[2]);
_b = stoi(splitted[3]);

LEDColor = Rgb{_r, _g, _b};
}
if (toUpper(zerlegt[0]) == "LEDTYPE")
if (toUpper(splitted[0]) == "LEDTYPE")
{
if (zerlegt[1] == "WS2812")
if (splitted[1] == "WS2812")
LEDType = LED_WS2812;
if (zerlegt[1] == "WS2812B")
if (splitted[1] == "WS2812B")
LEDType = LED_WS2812B;
if (zerlegt[1] == "SK6812")
if (splitted[1] == "SK6812")
LEDType = LED_SK6812;
if (zerlegt[1] == "WS2813")
if (splitted[1] == "WS2813")
LEDType = LED_WS2813;
}
}
Expand Down
41 changes: 9 additions & 32 deletions code/components/jomjol_controlcamera/ClassControllCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static camera_config_t camera_config = {
.pin_pclk = CAM_PIN_PCLK,

//XCLK 20MHz or 10MHz for OV2640 double FPS (Experimental)
.xclk_freq_hz = 20000000, // Orginalwert
// .xclk_freq_hz = 5000000, // Test, um die Bildfehler los zu werden !!!! Hängt in Version 9.2 !!!!
.xclk_freq_hz = 20000000, // Orginal value
// .xclk_freq_hz = 5000000, // Test to get rid of the image errors !!!! Hangs in version 9.2 !!!!
.ledc_timer = LEDC_TIMER_0,
.ledc_channel = LEDC_CHANNEL_0,

Expand All @@ -61,8 +61,7 @@ static camera_config_t camera_config = {
.jpeg_quality = 12, //0-63 lower number means higher quality
.fb_count = 1, //if more than one, i2s runs in continuous mode. Use only with JPEG
.fb_location = CAMERA_FB_IN_PSRAM, /*!< The location where the frame buffer will be allocated */
// .grab_mode = CAMERA_GRAB_WHEN_EMPTY,
.grab_mode = CAMERA_GRAB_LATEST, // erst ab neuer esp32cam-version
.grab_mode = CAMERA_GRAB_LATEST, // only from new esp32cam version

};

Expand Down Expand Up @@ -179,39 +178,17 @@ void CCamera::SetQualitySize(int qual, framesize_t resol)
image_height = 480;
image_width = 640;
}
// No higher Mode than VGA, damit der Kameraspeicher ausreicht.
/*
if (resol == FRAMESIZE_SVGA)
{
image_height = 600;
image_width = 800;
}
if (resol == FRAMESIZE_XGA)
{
image_height = 768;
image_width = 1024;
}
if (resol == FRAMESIZE_SXGA)
{
image_height = 1024;
image_width = 1280;
}
if (resol == FRAMESIZE_UXGA)
{
image_height = 1200;
image_width = 1600;
}
*/

}


void CCamera::EnableAutoExposure(int flashdauer)
void CCamera::EnableAutoExposure(int flash_duration)
{
ESP_LOGD(TAG, "EnableAutoExposure");
LEDOnOff(true);
if (flashdauer > 0)
if (flash_duration > 0)
LightOnOff(true);
const TickType_t xDelay = flashdauer / portTICK_PERIOD_MS;
const TickType_t xDelay = flash_duration / portTICK_PERIOD_MS;
vTaskDelay( xDelay );

camera_fb_t * fb = esp_camera_fb_get();
Expand All @@ -235,7 +212,7 @@ void CCamera::EnableAutoExposure(int flashdauer)
LEDOnOff(false);
LightOnOff(false);
isFixedExposure = true;
waitbeforepicture_org = flashdauer;
waitbeforepicture_org = flash_duration;
}


Expand Down Expand Up @@ -351,7 +328,7 @@ esp_err_t CCamera::CaptureToFile(std::string nm, int delay)
{
string ftype;

LEDOnOff(true); // Abgeschaltet, um Strom zu sparen !!!!!!
LEDOnOff(true); // Switched off to save power !

if (delay > 0)
{
Expand Down
5 changes: 2 additions & 3 deletions code/components/jomjol_controlcamera/ClassControllCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ class CCamera {
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
void SetLEDIntensity(float _intrel);

void EnableAutoExposure(int flashdauer);
void EnableAutoExposure(int flash_duration);
bool getCameraInitSuccessful();


framesize_t TextToFramesize(const char * text);

Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_fileserver_ota/server_ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static bool ota_update_task(std::string fn)

int data_read;

FILE* f = OpenFileAndWait(fn.c_str(), "rb"); // vorher nur "r"
FILE* f = OpenFileAndWait(fn.c_str(), "rb"); // previously only "r

if (f == NULL) { // File does not exist
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/components/jomjol_flowcontroll/ClassFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool ClassFlow::getNextLine(FILE* pfile, string *rt)
ESP_LOGD(TAG, "%s", zw);
*rt = zw;
*rt = trim(*rt);
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '[')) // Kommentarzeilen (; oder #) und Leerzeilen überspringen, es sei denn es ist ein neuer auskommentierter Paragraph
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '['))
{
*rt = "";
if (!fgets(zw, 1024, pfile))
Expand Down
Loading

0 comments on commit f6369ff

Please sign in to comment.