Skip to content

Commit

Permalink
AT command parsing and default fPort changes
Browse files Browse the repository at this point in the history
  • Loading branch information
beegee-tokyo committed Oct 17, 2024
1 parent 21f4fb6 commit e5734ea
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Arduino library for RAKWireless WisBlock Core modules that takes all the LoRaWAN

# Release Notes

## 2.0.19 AT command parsing and default fPort changes
- Allow upper and lower case and special characters in AT commands after the "="
- Change LoRaWAN default fPort from 0 to 1

## 2.0.18 Fix dependency to CayenneLPP
- Ownership of library has changed, PIO couldn't find the library

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ uint8_t g_user_at_cmd_num = sizeof(g_user_at_cmd_list_example) / sizeof(atcmd_t)
These five examples explain the usage of the API. In all examples the API callbacks and the additional functions (sensor readings, IRQ handling, GNSS location service) are separated into their own sketches.
- The simplest example (_**api-test.ino**_) just sends a 3 byte packet with the values 0x10, 0x00, 0x00.
- The other examples send their data encoded in the same format as RAKwireless WisNode devices. An explanation of the data format can be found in the RAKwireless [Documentation Center](https://docs.rakwireless.com/Product-Categories/WisTrio/RAK7205-5205/Quickstart/#decoding-sensor-data-on-chirpstack-and-ttn) :arrow_upper_right:. A ready to use packet decoder can be found in the RAKwireless Github repos in [RAKwireless_Standardized_Payload](https://github.com/RAKWireless/RAKwireless_Standardized_Payload) :arrow_upper_right:
- The other examples send their data encoded in the same format as RAKwireless WisNode devices. An explanation of the data format can be found in the RAKwireless [Documentation Center](https://docs.rakwireless.com/Product-Categories/WisTrio/RAK7205-5205/Quickstart/#decoding-sensor-data-on-chirpstack-and-ttn) :arrow_upper_right:. A ready to use packet decoder can be found in the RAKwireless Github repos in [RUI_LoRa_node_payload_decoder](https://github.com/RAKWireless/RUI_LoRa_node_payload_decoder) :arrow_upper_right:
- The LoRa P2P example (_**LoRa-P2P.ino**_) listens for P2P packets and displays them in the log.
_**The WisBlock-API-V2 has been used as well in the following PlatformIO projects:**_
Expand Down Expand Up @@ -1227,7 +1227,9 @@ AT Command functions: Taylor Lee ([email protected])
----
# Changelog
[Code releases](CHANGELOG.md)

- 2024-10-17 AT command parsing and default fPort changes
- Allow upper and lower case and special characters in AT commands after the "="
- Change LoRaWAN default fPort from 0 to 1
- 2024-06-26 Fix dependency to CayenneLPP
- Ownership of library has changed, PIO couldn't find the library
- 2023-12-24 Rework AT commands
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WisBlock-API-V2",
"version": "2.0.18",
"version": "2.0.19",
"keywords": [
"lora",
"Semtech",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WisBlock-API-V2
version=2.0.18
version=2.0.19
author=Bernd Giesecke <[email protected]>
maintainer=Bernd Giesecke <[email protected]>
sentence=API for WisBlock Core module
Expand Down
2 changes: 1 addition & 1 deletion src/WisBlock-API-V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ int8_t init_lora(void);
int8_t init_lorawan(bool region_change = false);
int8_t re_init_lorawan(void);
bool send_p2p_packet(uint8_t *data, uint8_t size);
lmh_error_status send_lora_packet(uint8_t *data, uint8_t size, uint8_t fport = 0);
lmh_error_status send_lora_packet(uint8_t *data, uint8_t size, uint8_t fport = 1);
extern bool g_lpwan_has_joined;
extern bool g_rx_fin_result;
extern bool g_join_result;
Expand Down
25 changes: 19 additions & 6 deletions src/at_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2829,6 +2829,8 @@ static void at_cmd_handle(void)
return;
}

bool convert_to_upper = true;

/**
* @brief Get Serial input and start parsing
*
Expand All @@ -2845,21 +2847,32 @@ void at_serial_input(uint8_t cmd)
Serial.printf(" \b");
}

// Convert to uppercase
if (cmd >= 'a' && cmd <= 'z')
if (cmd == '=')
{
cmd = toupper(cmd);
// Stop conversion to upper case
convert_to_upper = false;
}

if (convert_to_upper)
{ // Convert to uppercase
if (cmd >= 'a' && cmd <= 'z')
{
cmd = toupper(cmd);
}
}

// Check valid character
if ((cmd >= '0' && cmd <= '9') || (cmd >= 'a' && cmd <= 'z') ||
(cmd >= 'A' && cmd <= 'Z') || cmd == '?' || cmd == '+' || cmd == ':' ||
cmd == '=' || cmd == ' ' || cmd == ',' || cmd == '.' || cmd == '_')
// if ((cmd >= '0' && cmd <= '9') || (cmd >= 'a' && cmd <= 'z') ||
// (cmd >= 'A' && cmd <= 'Z') || cmd == '?' || cmd == '+' || cmd == ':' ||
// cmd == '=' || cmd == ' ' || cmd == ',' || cmd == '.' || cmd == '_' ||
// cmd == '&' || cmd == '\\' || cmd == '/' || cmd == '@')
if ((cmd >= 0x20 && cmd <= 0x7E))
{
atcmd[atcmd_index++] = cmd;
}
else if (cmd == '\r' || cmd == '\n')
{
convert_to_upper = true;
atcmd[atcmd_index] = '\0';
at_cmd_handle();
}
Expand Down

0 comments on commit e5734ea

Please sign in to comment.