Skip to content

Commit

Permalink
Anjay-esp32-client 24.11
Browse files Browse the repository at this point in the history
Improvements
- Fixed compatibility with ESP IDF v5.3,
  support for ESP IDF in versions older than v5.0 is dropped
  • Loading branch information
Kucmasz committed Nov 13, 2024
1 parent 10f9b3c commit 3500995
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 24.11 (November 13th, 2024)

### Improvements
- Fixed compatibility with ESP IDF v5.3,
support for ESP IDF in versions older than v5.0 is dropped

## 24.05 (May 28th, 2024)

### Improvements
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ The following LwM2M Objects are supported:
| M5StickC-Plus | Push button (/3347)<br>Light control (/3311)<br>Temperature sensor (/3303)<br>Accelerometer (/3313)<br>Gyroscope (/3343)

## Compiling and launching
1. Install ESP-IDF and its dependencies on your computer. Please follow the instructions at https://docs.espressif.com/projects/esp-idf/en/v4.4.5/esp32/get-started/index.html up to and including the point where you call `. $HOME/esp/esp-idf/export.sh`
* The project has been tested with ESP-IDF v4.4.5, but may work with other versions as well.
1. Install ESP-IDF and its dependencies on your computer. Please follow the instructions at https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32/get-started/index.html including `Manual Installation` up to the `Start a Project` subtitle.
* The project has been tested with ESP-IDF v5.3.1, but may work with other v5.x.x versions as well. Older versions are not supported.
1. Clone the repository `git clone https://github.com/AVSystem/Anjay-esp32-client.git` and navigate to project directory
1. Initialize and update submodules with `git submodule update --init --recursive`
1. Run `idf.py set-target esp32` in the project directory
Expand Down
2 changes: 1 addition & 1 deletion components/anjay-esp-idf
2 changes: 1 addition & 1 deletion main/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static esp_err_t connect(wifi_config_t *conf) {
esp_netif_t *netif = NULL;
esp_netif_ip_info_t ip;
for (int i = 0; i < esp_netif_get_nr_of_ifs(); ++i) {
netif = esp_netif_next(netif);
netif = esp_netif_next_unsafe(netif);
if (is_our_netif(TAG, netif)) {
ESP_LOGI(TAG, "Connected to %s", esp_netif_get_desc(netif));
ESP_ERROR_CHECK(esp_netif_get_ip_info(netif, &ip));
Expand Down
2 changes: 1 addition & 1 deletion main/fontx.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool GetFontx(FontxFile *fxs,
if (fxs[i].is_ank) {
offset = 17 + ascii * fxs[i].fsz;
if (fseek(fxs[i].file, offset, SEEK_SET)) {
printf("Fontx:seek(%u) failed.\n", offset);
printf("Fontx:seek(%lu) failed.\n", offset);
return false;
}
if (fread(pGlyph, 1, fxs[i].fsz, fxs[i].file) != fxs[i].fsz) {
Expand Down
2 changes: 1 addition & 1 deletion main/generate_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always
if(GIT_DESCRIBE_RESULT EQUAL 0)
string(STRIP "${CLIENT_VERSION_S}" CLIENT_VERSION)
else()
set(CLIENT_VERSION "24.05")
set(CLIENT_VERSION "24.11")
endif()
# Input and output files are extracted from parameters.
configure_file("${INPUT_FILE}" "${OUTPUT_FILE}" @ONLY)
2 changes: 1 addition & 1 deletion main/i2c_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "i2c_wrapper.h"

#define I2C_TIMEOUT_MS (10)
#define I2C_TIMEOUT_MS (100)
#define I2C_TIMEOUT_TICKS (I2C_TIMEOUT_MS / portTICK_PERIOD_MS)

int i2c_master_read_slave_reg(const i2c_device_t *const device,
Expand Down
2 changes: 1 addition & 1 deletion main/objects/light_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static int resource_write(anjay_t *anjay,

case RID_DIMMER: {
assert(riid == ANJAY_ID_INVALID);
return anjay_get_i32(ctx, &obj->instances[iid].power);
return anjay_get_i32(ctx, (int32_t *) &obj->instances[iid].power);
}

default:
Expand Down
16 changes: 9 additions & 7 deletions main/st7789.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>

#include <rom/gpio.h>

#include "sdkconfig.h"
#include "st7789.h"

Expand All @@ -84,8 +86,8 @@ static const int SPI_Frequency = SPI_MASTER_FREQ_20M;
static void delayMS(int ms) {
int _ms = ms + (portTICK_PERIOD_MS - 1);
TickType_t xTicksToDelay = _ms / portTICK_PERIOD_MS;
ESP_LOGD(TAG, "ms=%d _ms=%d portTICK_PERIOD_MS=%d xTicksToDelay=%d", ms,
_ms, portTICK_PERIOD_MS, xTicksToDelay);
ESP_LOGD(TAG, "ms=%d _ms=%d portTICK_PERIOD_MS=%lu xTicksToDelay=%lu", ms,
_ms, (uint32_t) portTICK_PERIOD_MS, xTicksToDelay);
vTaskDelay(xTicksToDelay);
}

Expand Down Expand Up @@ -420,7 +422,7 @@ void lcdDrawFillRect(TFT_t *dev,
if (y2 >= dev->_height)
y2 = dev->_height - 1;

ESP_LOGD(TAG, "offset(x)=%d offset(y)=%d", dev->_offsetx, dev->_offsety);
ESP_LOGD(TAG, "offset(x)=%u offset(y)=%u", dev->_offsetx, dev->_offsety);
uint16_t _x1 = x1 + dev->_offsetx;
uint16_t _x2 = x2 + dev->_offsetx;
uint16_t _y1 = y1 + dev->_offsety;
Expand Down Expand Up @@ -705,8 +707,8 @@ void lcdDrawRoundRect(TFT_t *dev,
y2 = temp;
} // endif

ESP_LOGD(TAG, "x1=%d x2=%d delta=%d r=%d", x1, x2, x2 - x1, r);
ESP_LOGD(TAG, "y1=%d y2=%d delta=%d r=%d", y1, y2, y2 - y1, r);
ESP_LOGD(TAG, "x1=%u x2=%u delta=%u r=%u", x1, x2, x2 - x1, r);
ESP_LOGD(TAG, "y1=%u y2=%u delta=%u r=%u", y1, y2, y2 - y1, r);
if (x2 - x1 < r)
return; // Add 20190517
if (y2 - y1 < r)
Expand All @@ -729,10 +731,10 @@ void lcdDrawRoundRect(TFT_t *dev,
err += ++y * 2 + 1;
} while (y < 0);

ESP_LOGD(TAG, "x1+r=%d x2-r=%d", x1 + r, x2 - r);
ESP_LOGD(TAG, "x1+r=%u x2-r=%u", x1 + r, x2 - r);
lcdDrawLine(dev, x1 + r, y1, x2 - r, y1, color);
lcdDrawLine(dev, x1 + r, y2, x2 - r, y2, color);
ESP_LOGD(TAG, "y1+r=%d y2-r=%d", y1 + r, y2 - r);
ESP_LOGD(TAG, "y1+r=%u y2-r=%u", y1 + r, y2 - r);
lcdDrawLine(dev, x1, y1 + r, x1, y2 - r, color);
lcdDrawLine(dev, x2, y1 + r, x2, y2 - r, color);
}
Expand Down
6 changes: 2 additions & 4 deletions main/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
*/

#include <stdint.h>
#include <string.h>

#include <esp_err.h>
#include <esp_system.h>
#include <esp_mac.h>

#include <avsystem/commons/avs_utils.h>

Expand All @@ -28,7 +26,7 @@ int get_device_id(device_id_t *out_id) {
memset(out_id->value, 0, sizeof(out_id->value));

uint8_t mac[6];
if (esp_efuse_mac_get_default(mac) != ESP_OK) {
if (esp_read_mac(mac, ESP_MAC_EFUSE_FACTORY) != ESP_OK) {
return -1;
}

Expand Down
2 changes: 2 additions & 0 deletions sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_ESP_MAIN_TASK_STACK_SIZE=4480
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"

CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y

0 comments on commit 3500995

Please sign in to comment.