@@ -129,7 +129,7 @@ STATIC bool camera_init_helper(size_t n_args, const mp_obj_t *pos_args, mp_map_t
129
129
return true;
130
130
}
131
131
132
- STATIC mp_obj_t camera_init (mp_uint_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
132
+ STATIC mp_obj_t camera_init (size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
133
133
bool init = camera_init_helper (n_pos_args , pos_args , kw_args );
134
134
if (init ) {
135
135
return mp_const_true ;
@@ -151,7 +151,7 @@ STATIC mp_obj_t camera_deinit() {
151
151
}
152
152
STATIC MP_DEFINE_CONST_FUN_OBJ_0 (camera_deinit_obj , camera_deinit );
153
153
154
- STATIC mp_obj_t camera_skip_frames (uint n_args , const mp_obj_t * args , mp_map_t * kw_args ) {
154
+ STATIC mp_obj_t camera_skip_frames (size_t n_args , const mp_obj_t * args , mp_map_t * kw_args ) {
155
155
mp_map_elem_t * kw_arg = mp_map_lookup (kw_args , MP_OBJ_NEW_QSTR (MP_QSTR_time ), MP_MAP_LOOKUP );
156
156
mp_int_t time = 300 ; // OV Recommended.
157
157
@@ -260,8 +260,12 @@ STATIC mp_obj_t camera_pixformat(mp_obj_t pixformat) {
260
260
return mp_const_false ;
261
261
}
262
262
263
- s -> set_pixformat (s , format );
264
- return mp_const_none ;
263
+ int ret = s -> set_pixformat (s , format );
264
+ if (ret == 0 ) {
265
+ return mp_const_true ;
266
+ } else {
267
+ return mp_const_false ;
268
+ }
265
269
}
266
270
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_pixformat_obj , camera_pixformat );
267
271
@@ -277,8 +281,12 @@ STATIC mp_obj_t camera_framesize(mp_obj_t framesize) {
277
281
return mp_const_false ;
278
282
}
279
283
280
- s -> set_framesize (s , size );
281
- return mp_const_none ;
284
+ int ret = s -> set_framesize (s , size );
285
+ if (ret == 0 ) {
286
+ return mp_const_true ;
287
+ } else {
288
+ return mp_const_false ;
289
+ }
282
290
}
283
291
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_framesize_obj , camera_framesize );
284
292
@@ -290,8 +298,12 @@ STATIC mp_obj_t camera_contrast(mp_obj_t contrast) {
290
298
}
291
299
292
300
int val = mp_obj_get_int (contrast ); // -2,2 (default 0). 2 highcontrast
293
- s -> set_contrast (s , val );
294
- return mp_const_none ;
301
+ int ret = s -> set_contrast (s , val );
302
+ if (ret == 0 ) {
303
+ return mp_const_true ;
304
+ } else {
305
+ return mp_const_false ;
306
+ }
295
307
}
296
308
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_contrast_obj , camera_contrast );
297
309
@@ -303,8 +315,12 @@ STATIC mp_obj_t camera_global_gain(mp_obj_t gain_level) {
303
315
}
304
316
305
317
int val = mp_obj_get_int (gain_level ); // -2,2 (default 0). 2 highcontrast
306
- s -> set_gain_ctrl (s , val );
307
- return mp_const_none ;
318
+ int ret = s -> set_gain_ctrl (s , val );
319
+ if (ret == 0 ) {
320
+ return mp_const_true ;
321
+ } else {
322
+ return mp_const_false ;
323
+ }
308
324
}
309
325
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_global_gain_obj , camera_global_gain );
310
326
@@ -315,8 +331,12 @@ STATIC mp_obj_t camera_hmirror(mp_obj_t direction) {
315
331
return mp_const_false ;
316
332
}
317
333
int dir = mp_obj_get_int (direction );
318
- s -> set_hmirror (s , dir );
319
- return mp_const_none ;
334
+ int ret = s -> set_hmirror (s , dir );
335
+ if (ret == 0 ) {
336
+ return mp_const_true ;
337
+ } else {
338
+ return mp_const_false ;
339
+ }
320
340
}
321
341
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_hmirror_obj , camera_hmirror );
322
342
@@ -327,8 +347,12 @@ STATIC mp_obj_t camera_vflip(mp_obj_t direction) {
327
347
return mp_const_false ;
328
348
}
329
349
int dir = mp_obj_get_int (direction );
330
- s -> set_vflip (s , dir );
331
- return mp_const_none ;
350
+ int ret = s -> set_vflip (s , dir );
351
+ if (ret == 0 ) {
352
+ return mp_const_true ;
353
+ } else {
354
+ return mp_const_false ;
355
+ }
332
356
}
333
357
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_vflip_obj , camera_vflip );
334
358
@@ -339,8 +363,12 @@ STATIC mp_obj_t camera_colorbar(mp_obj_t enable) {
339
363
return mp_const_false ;
340
364
}
341
365
int val = mp_obj_get_int (enable );
342
- s -> set_colorbar (s , (bool )val );
343
- return mp_const_none ;
366
+ int ret = s -> set_colorbar (s , (bool )val );
367
+ if (ret == 0 ) {
368
+ return mp_const_true ;
369
+ } else {
370
+ return mp_const_false ;
371
+ }
344
372
}
345
373
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (camera_colorbar_obj , camera_colorbar );
346
374
0 commit comments