Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
5fb775a0
Commit
5fb775a0
authored
10 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
esp8266: Handle exceptions in callback.
parent
6ec650b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
esp8266/modesp.c
+14
-1
14 additions, 1 deletion
esp8266/modesp.c
with
14 additions
and
1 deletion
esp8266/modesp.c
+
14
−
1
View file @
5fb775a0
...
@@ -32,12 +32,25 @@
...
@@ -32,12 +32,25 @@
#include
"py/obj.h"
#include
"py/obj.h"
#include
"py/gc.h"
#include
"py/gc.h"
#include
"py/runtime.h"
#include
"py/runtime.h"
#include
"py/pfenv.h"
#include MICROPY_HAL_H
#include MICROPY_HAL_H
#include
"queue.h"
#include
"queue.h"
#include
"user_interface.h"
#include
"user_interface.h"
// Singleton instance of scan callback, meaning that there can be only
// one concurrent AP scan.
STATIC
mp_obj_t
scan_cb_obj
;
STATIC
mp_obj_t
scan_cb_obj
;
mp_obj_t
call_function_1_protected
(
mp_obj_t
fun
,
mp_obj_t
arg
)
{
nlr_buf_t
nlr
;
if
(
nlr_push
(
&
nlr
)
==
0
)
{
return
mp_call_function_1
(
fun
,
arg
);
}
else
{
mp_obj_print_exception
(
printf_wrapper
,
NULL
,
(
mp_obj_t
)
nlr
.
ret_val
);
return
(
mp_obj_t
)
nlr
.
ret_val
;
}
}
STATIC
void
esp_scan_cb
(
scaninfo
*
si
,
STATUS
status
)
{
STATIC
void
esp_scan_cb
(
scaninfo
*
si
,
STATUS
status
)
{
//printf("in pyb_scan_cb: %d, si=%p, si->pbss=%p\n", status, si, si->pbss);
//printf("in pyb_scan_cb: %d, si=%p, si->pbss=%p\n", status, si, si->pbss);
struct
bss_info
*
bs
;
struct
bss_info
*
bs
;
...
@@ -50,7 +63,7 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
...
@@ -50,7 +63,7 @@ STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
t
->
items
[
3
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
rssi
);
t
->
items
[
3
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
rssi
);
t
->
items
[
4
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
authmode
);
t
->
items
[
4
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
authmode
);
t
->
items
[
5
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
is_hidden
);
t
->
items
[
5
]
=
MP_OBJ_NEW_SMALL_INT
(
bs
->
is_hidden
);
mp_
call_function_1
(
scan_cb_obj
,
t
);
call_function_1
_protected
(
scan_cb_obj
,
t
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment