1
0
mirror of https://gitee.com/openLuat/LuatOS synced 2025-08-17 22:18:03 +08:00

add:mobile允许开机优先使用SIM0

This commit is contained in:
alienwalker 2023-02-03 12:18:12 +08:00
parent 7ded1adee9
commit 4690d5d6eb
3 changed files with 14 additions and 3 deletions

View File

@ -196,7 +196,8 @@ static int l_mobile_number(lua_State* L) {
/**
SIM卡槽,
@api mobile.simid(id)
@int SIM卡的编号, 0, 1EC61824IO
@int SIM卡的编号, 0, 1, EC61824IO
@boolean SIM0SIM卡编号写2自适应才有用true优先用SIM0false则优先用上一次探测到的false
@return int sim卡槽编号,-1
*/
static int l_mobile_simid(lua_State* L) {
@ -207,6 +208,11 @@ static int l_mobile_simid(lua_State* L) {
ret = luat_mobile_set_sim_id(lua_tointeger(L, 1));
LLOGI("sim set to %d , ret %d", lua_tointeger(L, 1), ret);
}
if (LUA_TBOOLEAN == lua_type(L, 2)) {
if (lua_toboolean(L, 2)) {
luat_mobile_set_sim_detect_sim0_fisrt();
}
}
ret = luat_mobile_get_sim_id(&id);
if (ret == 0) {
lua_pushinteger(L, id);

View File

@ -110,6 +110,12 @@ int luat_mobile_get_sim_id(int *id);
*/
int luat_mobile_set_sim_id(int id);
/**
* @brief sim0
*
*/
void luat_mobile_set_sim_detect_sim0_fisrt(void);
/**
* @brief PDN激活时是否要IPV6网络
* @param onoff 1 0

View File

@ -7,11 +7,10 @@ log.info("main", PROJECT, VERSION)
-- sys库是标配
_G.sys = require("sys")
-- 对于双卡的设备, 可以设置为自动选sim卡
-- 但是, 这样SIM1所在管脚就强制复用为SIM功能, 不可以再复用为GPIO
-- mobile.simid(2)
mobile.simid(2,true)--优先用SIM0
sys.taskInit(function()
-- mobile.apn(0,2,"") -- 使用默认APN激活CID2
mobile.rtime(2) -- 在无数据交互时RRC2秒后自动释放