Skip to content

Commit 73611fc

Browse files
committed
config: raw gamma & lens correction
refs #16
1 parent 04601d8 commit 73611fc

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

examples/AsyncCam/handlers.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ static const char FRONTPAGE[] = R"EOT(
1616
<select name="specialEffect" title="special effect">%specialEffect%</select>
1717
%hmirror%
1818
%vflip%
19+
%rawGma%
20+
%lensCorrection%
1921
<input type="submit" value="update">
2022
</p></form>
2123
<p id="controls">
@@ -82,12 +84,12 @@ rewriteFrontpage(const esp32cam::Settings& s, const String& var) {
8284
} else if (var == "gain") {
8385
#define SHOW_GAIN(val, dsp) \
8486
b.printf("<option value=\"%d\"%s>%dx</option>", val, s.gain == val ? " selected" : "", dsp)
85-
b.printf("<optgroup label=\"AGC=off\">");
87+
b.printf("<optgroup label=\"AGC=0\">");
8688
for (int i = 1; i <= 31; ++i) {
8789
SHOW_GAIN(i, i);
8890
}
8991
b.printf("</optgroup>");
90-
b.printf("<optgroup label=\"AGC=on\">");
92+
b.printf("<optgroup label=\"AGC=1\">");
9193
for (int i = 2; i <= 128; i <<= 1) {
9294
SHOW_GAIN(-i, i);
9395
}
@@ -138,6 +140,8 @@ rewriteFrontpage(const esp32cam::Settings& s, const String& var) {
138140
SHOW_INT(saturation, -2, 2)
139141
SHOW_BOOL(hmirror)
140142
SHOW_BOOL(vflip)
143+
SHOW_BOOL(rawGma)
144+
SHOW_BOOL(lensCorrection)
141145
#undef SHOW_INT
142146
#undef SHOW_BOOL
143147
return b;
@@ -164,6 +168,8 @@ handleUpdate(AsyncWebServerRequest* req) {
164168
SAVE_INT(specialEffect);
165169
SAVE_BOOL(hmirror);
166170
SAVE_BOOL(vflip);
171+
SAVE_BOOL(rawGma);
172+
SAVE_BOOL(lensCorrection);
167173
#undef SAVE_BOOL
168174
#undef SAVE_INT
169175
});

src/esp32cam/config.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ CameraClass::status() const {
107107
result.saturation = ss.saturation;
108108
result.lightMode = ss.awb_gain ? static_cast<LightMode>(ss.wb_mode) : LightMode::NONE;
109109
result.specialEffect = static_cast<SpecialEffect>(ss.special_effect);
110-
if (ss.agc) {
111-
result.gain = (-2) << ss.gainceiling;
112-
} else {
113-
result.gain = 1 + static_cast<int8_t>(ss.agc_gain);
114-
}
110+
result.gain = ss.agc ? ((-2) << ss.gainceiling) : (1 + static_cast<int8_t>(ss.agc_gain));
115111
result.hmirror = ss.hmirror != 0;
116112
result.vflip = ss.vflip != 0;
113+
result.rawGma = ss.raw_gma != 0;
114+
result.lensCorrection = ss.lenc != 0;
117115
return result;
118116
}
119117

@@ -165,6 +163,8 @@ CameraClass::update(const Settings& settings, int sleepFor) {
165163
UPDATE2(special_effect, settings.specialEffect);
166164
UPDATE1(hmirror);
167165
UPDATE1(vflip);
166+
UPDATE2(raw_gma, settings.rawGma);
167+
UPDATE2(lenc, settings.lensCorrection);
168168

169169
if (settings.gain > 0) {
170170
UPDATE4(agc, 0, set_gain_ctrl, int);

src/esp32cam/config.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ struct Settings {
106106

107107
/** @brief Vertical flip. */
108108
bool vflip = false;
109+
110+
/** @brief Raw gamma mode. */
111+
bool rawGma = false;
112+
113+
/** @brief Lens correction mode. */
114+
bool lensCorrection = false;
109115
};
110116

111117
} // namespace esp32cam

0 commit comments

Comments
 (0)