muizenval

Observe mouse traps remotely
Log | Files | Refs

commit 85f005afe82d7ce317e5cf1771366ecf7d5a5f8b
parent a308cde4d3c79bad62f5f1306a4bffc6499859e6
Author: Friedel Schön <[email protected]>
Date:   Thu,  9 Jun 2022 22:41:53 +0200

documenting 5g-code

Diffstat:
M5g-client/5g-board.ino | 7++++++-
M5g-client/command.h | 2++
M5g-client/command.ino | 1+
3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/5g-client/5g-board.ino b/5g-client/5g-board.ino @@ -2,6 +2,7 @@ #include "config.h" void setup() { + // -*- hardware initiation -*- pinMode(powerPin, OUTPUT); // Put voltage on the nb-iot module pinMode(voltagePin, OUTPUT); // Switch module voltage pinMode(enablePin, OUTPUT); // Set state to active @@ -19,6 +20,7 @@ void setup() { ; + // -*- module initialization -*- usbSerial.print("[INFO] waiting for module to start up"); for (;;) { usbSerial.print('.'); @@ -49,7 +51,7 @@ void setup() { sendCommand("AT+CEDRXS=0"); // Disable eDRX usbSerial.println("[INFO] disabled power safe"); - + // -*- internet initialization -*- sendCommand("AT+CFUN=15", COMMAND_BLOCK); // Reset the module sendCommand("AT+UMNOPROF=1", COMMAND_BLOCK); // Set MNO profile (1=automatic,100=standard europe) sendCommand("AT+URAT=7,8"); // Set URAT to LTE-M/NB-IOT @@ -76,6 +78,8 @@ void setup() { usbSerial.println("[INFO] connected!"); + // -*- server connection -*- + /* AT+UHTTP=0,0,"86.92.67.21" @@ -94,6 +98,7 @@ AT+UHTTPC=0,5,"/api/search_connect","","TEST!",1 } void loop() { + // -*- passthrough for custom commands -*- while (usbSerial.available()) modemSerial.write(usbSerial.read()); diff --git a/5g-client/command.h b/5g-client/command.h @@ -1,5 +1,6 @@ #pragma once +// -*- enums and structs -*- enum command_status { COMMAND_OK = 0, // command succeed COMMAND_ERROR = 1, // command returned an error @@ -13,5 +14,6 @@ enum command_flags { COMMAND_EVENT = 1 << 2, // handle '+'-responses as event }; +// -*- declarations -*- command_status sendCommand(const char* request, char* response, command_flags flags = COMMAND_NONE); command_status sendCommand(const char* request, command_flags flags = COMMAND_NONE); \ No newline at end of file diff --git a/5g-client/command.ino b/5g-client/command.ino @@ -1,6 +1,7 @@ #include "command.h" #include "config.h" +// -*- helper functions -*- command_status sendCommand(const char* request, char* response, command_flags flags) { char line[lineBuffer]; size_t lineLen;