Skip to content

Commit 9f8efe4

Browse files
committed
Bug corrected?
1 parent 1456a95 commit 9f8efe4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/modcamera.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#error Camera only works on boards configured with spiram
3636
#endif
3737

38+
// Supporting functions
3839
void raise_micropython_error_from_esp_err(esp_err_t err) {
3940
switch (err) {
4041
case ESP_OK:
@@ -71,6 +72,14 @@ void raise_micropython_error_from_esp_err(esp_err_t err) {
7172
}
7273
}
7374

75+
static int map(int value, int fromLow, int fromHigh, int toLow, int toHigh) {
76+
if (fromHigh == fromLow) {
77+
mp_raise_ValueError(MP_ERROR_TEXT("fromLow und fromHigh shall not be equal"));
78+
}
79+
return (int)((int32_t)(value - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow);
80+
}
81+
82+
// Camera HAL Funcitons
7483
void mp_camera_hal_construct(
7584
mp_camera_obj_t *self,
7685
int8_t data_pins[8],
@@ -290,14 +299,6 @@ const mp_rom_map_elem_t mp_camera_hal_gainceiling_table[] = {
290299
{ MP_ROM_QSTR(MP_QSTR_128X), MP_ROM_INT(GAINCEILING_128X) },
291300
};
292301

293-
// Supporting functions
294-
static int map(int value, int fromLow, int fromHigh, int toLow, int toHigh) {
295-
if (fromHigh == fromLow) {
296-
mp_raise_ValueError(MP_ERROR_TEXT("fromLow und fromHigh shall not be equal"));
297-
}
298-
return (int)((int32_t)(value - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow);
299-
}
300-
301302
//TODO: Makros with convertion function, since the API will use standarized values.
302303
// Helper functions to get and set camera and sensor information
303304
#define SENSOR_STATUS_GETSET_IN_RANGE(type, name, status_field_name, setter_function_name, min_val, max_val) \

0 commit comments

Comments
 (0)