mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
Added fix to adc.readvdd33() to prevent crashing in station mode while
connected
This commit is contained in:
parent
fc8fa2cc91
commit
dd00e31027
@ -24,11 +24,23 @@ static int adc_sample( lua_State* L )
|
|||||||
static int adc_readvdd33( lua_State* L )
|
static int adc_readvdd33( lua_State* L )
|
||||||
{
|
{
|
||||||
uint32_t vdd33 = 0;
|
uint32_t vdd33 = 0;
|
||||||
|
|
||||||
os_intr_lock();
|
|
||||||
vdd33 = readvdd33();
|
|
||||||
os_intr_unlock();
|
|
||||||
|
|
||||||
|
if(STATION_MODE == wifi_get_opmode())
|
||||||
|
{
|
||||||
|
// Bug fix
|
||||||
|
if (wifi_station_get_connect_status()!=0)
|
||||||
|
{
|
||||||
|
return luaL_error( L, "Can't read vdd33 while station is connected" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vdd33 = readvdd33();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vdd33 = readvdd33();
|
||||||
|
}
|
||||||
lua_pushinteger(L, vdd33);
|
lua_pushinteger(L, vdd33);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user