diff --git a/VERSION b/VERSION index bd8bf88..943f9cb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.0 +1.7.1 diff --git a/changelog.json b/changelog.json index 33de873..b689a93 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,22 @@ { "versions": [ + { + "version": "1.7.1", + "date": "2026-05-12", + "changes": { + "features": [], + "improvements": [ + "Loop SARA: detection SIM injoignable avant escalade hardware reboot (evite les reboots inutiles en boucle quand la SIM est absente/mal inseree)", + "Logs HTML: bloc rouge tres visible quand la SIM n'est pas detectee (bordure, fond rose, message d'action clair)", + "Notification WiFi dediee: 'SIM NOT DETECTED -> physical check required' au lieu du generique 'UDP socket creation failed'" + ], + "fixes": [ + "Plus de hardware reboots repetes a chaque cycle de 60s quand la SIM est physiquement injoignable (economie courant + usure transistor GPIO 16)" + ], + "compatibility": [] + }, + "notes": "Quand la sequence PDP echoue, le script verifie maintenant AT+CPIN? et AT+CCID pour diagnostiquer si le probleme vient de la SIM ou du reseau. Si SIM absente: notification claire + arret propre, pas de reboot. Si SIM presente: comportement actuel (reboot hardware). Le check ne s'execute qu'en cas d'erreur, zero impact sur le happy path." + }, { "version": "1.7.0", "date": "2026-04-27", diff --git a/loop/SARA_send_data_v2.py b/loop/SARA_send_data_v2.py index 9bc1b53..57872fc 100755 --- a/loop/SARA_send_data_v2.py +++ b/loop/SARA_send_data_v2.py @@ -620,6 +620,35 @@ def reset_PSD_CSD_connection(): return pdp_reset_success +def check_sim_status(): + """ + Quick SIM presence check using AT+CPIN? and AT+CCID. + Called only when something has already gone wrong (eg. PDP reset failed), + to distinguish a SIM problem from a network/PDP problem. + returns True if SIM is detected and READY, False otherwise. + """ + print("➡️ Checking SIM status (AT+CPIN? and AT+CCID)") + + # 1. CPIN -> doit retourner READY + ser_sara.reset_input_buffer() + ser_sara.write(b'AT+CPIN?\r') + response_cpin = read_complete_response(ser_sara, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=False) + print('
', end="") + print(response_cpin) + print("
", end="") + cpin_ok = response_cpin is not None and "READY" in response_cpin + + # 2. CCID -> doit retourner l'ICCID + ser_sara.reset_input_buffer() + ser_sara.write(b'AT+CCID\r') + response_ccid = read_complete_response(ser_sara, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=False) + print('', end="") + print(response_ccid) + print("
", end="") + ccid_ok = response_ccid is not None and "+CCID" in response_ccid and "ERROR" not in response_ccid + + return cpin_ok and ccid_ok + def reset_server_hostname(profile_id): """ Function that reset server hostname (URL) connection for the SARA R5 @@ -1208,6 +1237,34 @@ try: print(response_SARA_1) else: print("⛔There were issues with the modem CSD PSD reinitialize process") + + # Diagnostic : SIM injoignable OU problème réseau/PDP ? + sim_ok = check_sim_status() + + if not sim_ok: + # SIM injoignable -> un reboot hardware ne résoudra rien + print('