Skip to content

Commit

Permalink
faet: AT+INFO support multiple info
Browse files Browse the repository at this point in the history
* faet: AT+INFO support multiple info

* fix: Corrected we2 DEV BOARD SPI synchronization pin definitions
  • Loading branch information
LynnL4 committed Mar 26, 2024
1 parent 41cf3f1 commit 8ef2f15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion porting/himax/we2/boards/dev_board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extern "C" {
{ hx_drv_scu_set_PB5_pinmux(SCU_PB5_PINMUX_SPI_S_CS, 1); }
#define CONFIG_EL_SPI_CTRL_INIT_F \
{ hx_drv_scu_set_PB8_pinmux(SCU_PB8_PINMUX_GPIO2_1, 1); }
#define CONFIG_EL_SPI_CTRL_PIN GPIO21
#define CONFIG_EL_SPI_CTRL_PIN GPIO2

#ifdef __cplusplus
}
Expand Down
12 changes: 8 additions & 4 deletions sscma/callback/info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ using namespace sscma::utility;

void set_info(const std::vector<std::string>& argv, void* caller) {
char info[SSCMA_CMD_MAX_LENGTH]{};

char key[sizeof(SSCMA_STORAGE_KEY_INFO) + 4]{};
std::strncpy(info, argv[1].c_str(), sizeof(info) - 1);
auto ret = static_resource->storage->emplace(el_make_storage_kv(SSCMA_STORAGE_KEY_INFO, info)) ? EL_OK : EL_EIO;
snprintf(key, sizeof(key), SSCMA_STORAGE_KEY_INFO "#%d", static_resource->current_model_id);
auto ret = static_resource->storage->emplace(el_make_storage_kv(key, info)) ? EL_OK : EL_EIO;

auto ss{concat_strings("\r{\"type\": 0, \"name\": \"",
argv[0],
Expand All @@ -31,10 +32,13 @@ void set_info(const std::vector<std::string>& argv, void* caller) {

void get_info(const std::string& cmd, void* caller) {
char info[SSCMA_CMD_MAX_LENGTH]{};
char key[sizeof(SSCMA_STORAGE_KEY_INFO) + 4]{};
auto ret = EL_OK;

if (static_resource->storage->contains(SSCMA_STORAGE_KEY_INFO))
ret = static_resource->storage->get(el_make_storage_kv(SSCMA_STORAGE_KEY_INFO, info)) ? EL_OK : EL_EIO;
snprintf(key, sizeof(key), SSCMA_STORAGE_KEY_INFO "#%d", static_resource->current_model_id);

if (static_resource->storage->contains(key))
ret = static_resource->storage->get(el_make_storage_kv(key, info)) ? EL_OK : EL_EIO;

auto ss{concat_strings("\r{\"type\": 0, \"name\": \"",
cmd,
Expand Down

0 comments on commit 8ef2f15

Please sign in to comment.