Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamV:BK7231N_1.0.1
REG:cpsr spsr r13 r14
SVC:000000D3 00401C1C 000033AC
IRQ:000000d2 00000010 00401e0c a0e1cccd
FIR:000000d1 00000010 00401ffc 4f6f8c03
SYS:000000df 0040192c 00000158
ST:00000000
J 0x10000
bk_misc_init_start_type 0 0
prvHeapInit-start addr:0x414240, size:114112
[Flash]id:0xeb6015
sctrl_sta_ps_init
cset:0 0 0 0
Entering initLog()...
Commands registered!
initLog() done!
Info:MAIN:Main_Init_Before_Delay
nelliug54 wrote:@dheenhasty
To avoid getting in the corruption state I would suggest one change in the script.
As the sensor aproximates to the critical battery voltage (2V) we could publish an mqtt error message and ask to replace batteries and increase DeepSleep to 4h for example or gradually the DeepSleep timer to 2h, 4h or 10h with adding more 'if' statements..
for example:
. . . . .
echo "activate voltage meassurement"
setChannel 5 1
delay_s 1
if $CH4/1000<=2200 then goto batlow
. . . . .
. . . . .
DeepSleep 600
batlow:
publish "Bat_fail_Replace_asap" $CH4/1000'
. . . . . .
. . . . . .
echo "deepsleep 4h for example"
DeepSleep 14400
nelliug54 wrote:Hi guys, it is logged this set of error messages everytime the read is launched:
Error:CMD:command with name SHT_Calibrate already exists!
Error:CMD:command with name SHT_MeasurePer already exists!
Error:CMD:command with name SHT_LaunchPer already exists!
Error:CMD:command with name SHT_StopPer already exists!
Error:CMD:command with name SHT_Measure already exists!
Error:CMD:command with name SHT_Heater already exists!
Error:CMD:command with name SHT_GetStatus already exists!
Do you know the reason for it?
nelliug54 wrote:I don't get the function of the Q1 n-mosfet , its connections have been checked several times...
I hope no mistakes.
p.kaczmarek2 wrote:Wasn't Q1 for reverse polarity protection?
@dheenhasty are your changes ready to merge? At least that part that's done.
By the way, it seems that "wake up on GPIO" works only on T and not on N.
Quote:static commandResult_t CMD_DeepSleep(const void* context, const char* cmd, const char* args, int cmdFlags) {
int timeMS, idx_map = 0, edg_map = 0;
Tokenizer_TokenizeString(args, 0);
// following check must be done after 'Tokenizer_TokenizeString',
// so we know arguments count in Tokenizer. 'cmd' argument is
// only for warning display
if (Tokenizer_CheckArgsCountAndPrintWarning(cmd, 1)) {
return CMD_RES_NOT_ENOUGH_ARGUMENTS;
}
timeMS = Tokenizer_GetArgInteger(0);
idx_map = Tokenizer_GetArgInteger(1);
edg_map = Tokenizer_GetArgInteger(2);
#ifdef PLATFORM_BEKEN
// It requires a define in SDK file:
// OpenBK7231T\platforms\bk7231t\bk7231t_os\beken378\func\include\manual_ps_pub.h
// define there:
// #define PS_SUPPORT_MANUAL_SLEEP 1
extern void bk_wlan_ps_wakeup_with_timer(UINT32 sleep_time, UINT32 idx_map, UINT32 edg_map);
bk_wlan_ps_wakeup_with_timer(timeMS, idx_map, edg_map);
return CMD_RES_OK;
#elif defined(PLATFORM_W600)
#endif
return CMD_RES_OK;
}
Quote:void bk_wlan_ps_wakeup_with_timer(UINT32 sleep_time,UINT32 idx_map, UINT32 edg_map)
{
PS_DEEP_CTRL_PARAM deep_sleep_param;
deep_sleep_param.sleep_time = sleep_time;
deep_sleep_param.wake_up_way = PS_DEEP_WAKEUP_GPIO;
deep_sleep_param.gpio_index_map = idx_map;
deep_sleep_param.gpio_edge_map = edg_map;
os_printf("---deep sleep test param : 0x%0X 0x%0X 0x%0X 0x%0X %d %d\r\n",
deep_sleep_param.gpio_index_map,
deep_sleep_param.gpio_edge_map,
deep_sleep_param.gpio_last_index_map,
deep_sleep_param.gpio_last_edge_map,
deep_sleep_param.sleep_time,
deep_sleep_param.wake_up_way);
bk_enter_deep_sleep_mode(&deep_sleep_param);
}
startDriver SHT3X
startDriver NTP
setChannelType 1 temperature_div10
setChannelType 2 humidity
SHT_Measure
ntp_setServer 172.17.7.1
addRepeatingEvent 60 -1 SHT_Measuredheenhasty wrote:
i have tried tuya mcu for some powersaving it include .... but it's not making any difference.
dheenhasty wrote:
the only thing that came in mind is that after the reset it lost the init/preinit pattern. you can try to do a stop of sht driver it will launch a soft reset of the SHT sensor.
ShadowLight30 wrote:
Ok I didn't know about the power saving feature. Since I'm using relays, it doesn't matter for me![]()
TL;DR: Stock firmware can empty two AAA cells in just 6 h at a 10-min refresh rate [Elektroda, dheenhasty, post #20385425] “SHT30 seems very simple to support” [Elektroda, p.kaczmarek2, post #20362193] Use DeepSleep + PowerSave to cut current by >90 %.
Why it matters: Proper scripting turns a one-week gadget into a months-long sensor.
• MCU: Beken BK7231N CBU module, 3.3 V core, Wi-Fi b/g/n [Elektroda, p.kaczmarek2, post #20362193] • Temp/Humidity chips: SHT30 or CHT8310/8315, I²C @ 100 kHz [Sensirion, 2023] • Battery range: 2.0 – 3.0 V (two AAA) [Elektroda, user_param_key dump] • DeepSleep current: ≈ 6 µA; active Wi-Fi current: ≈ 70 mA [Elektroda, dheenhasty, post #20393117] • Typical script wake-time: 8–12 s, 15-min cycle ⇒ ~1 % duty-cycle power use.
addRepeatingEventID 30 1 999 DeepSleep 900 before waitFor MQTTState 1; if MQTT is still down after 30 s the sensor sleeps for 15 min [Elektroda, erdeidominik1999, post #20792052]PowerSave. 2 ) measure once, publish, sleep:startDriver SHT3X → waitFor MQTTState 1 → SHT_Measure → publishChannels → DeepSleep 900. 3 ) Use flag 37 for quick Wi-Fi connect. Users report >30 days on AAA with a 15-min cycle [Elektroda, dheenhasty, post #20456982]mqtt_broadcastInterval left at 1 s sends five retained topics, stretching awake time. Set it to 60 s or disable extra broadcasts to avoid triple publishes [Elektroda, Xinayder, post #20882846]SHT_Calibrate <TempOffset> <RHOffset> once in autoexec, e.g. SHT_Calibrate -2.4 3 lowers reported temperature by 2.4 °C and raises humidity by 3 % RH [Elektroda, dheenhasty, post #20458926]PowerSave active and no WebLog, idle current falls from ~70 mA to 6 - 8 mA, a 90 % reduction [Elektroda, dheenhasty, post #20393117]OBK_XXXX AP.temperature_div10 for 0.1 °C granularity or divide in publish: publishFloat temp $CH2/10. OBK trims trailing zeros from JSON [Elektroda, p.kaczmarek2, post #20458933]autoexec.bat, letting you reconfigure via AP without UART [Elektroda, p.kaczmarek2, post #21014538]