Browse Source

update

master
zhaohe 1 year ago
parent
commit
bcbdb4c5d7
  1. 2
      .settings/org.eclipse.core.resources.prefs
  2. 2
      Core/Inc/FreeRTOSConfig.h
  3. 3
      dbdb_liquid_path_control_v2.ioc
  4. 2
      iflytop_canbus_protocol
  5. 6
      usrc/base/config_service.cpp
  6. 2
      usrc/base/config_service.hpp
  7. 11
      usrc/base/device_info.cpp
  8. 20
      usrc/base/device_info.hpp
  9. 0
      usrc/gpio_mgr.cpp
  10. 3
      usrc/gpio_mgr.hpp
  11. 24
      usrc/main.cpp
  12. 8
      usrc/project_configs.h
  13. 3
      usrc/project_dep.hpp
  14. 74
      usrc/protocol_impl/protocol_impl_service.cpp
  15. 10
      usrc/protocol_impl/protocol_impl_service.hpp
  16. 2
      zsdk

2
.settings/org.eclipse.core.resources.prefs

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=GBK

2
Core/Inc/FreeRTOSConfig.h

@ -87,7 +87,7 @@
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_TASK_PRIORITY ( 3 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH 1024

3
dbdb_liquid_path_control_v2.ioc

@ -39,12 +39,13 @@ Dma.USART3_TX.1.Priority=DMA_PRIORITY_LOW
Dma.USART3_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
FREERTOS.FootprintOK=true
FREERTOS.INCLUDE_uxTaskGetStackHighWaterMark=1
FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU,configTOTAL_HEAP_SIZE,configMINIMAL_STACK_SIZE,INCLUDE_uxTaskGetStackHighWaterMark,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configUSE_TIMERS
FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU,configTOTAL_HEAP_SIZE,configMINIMAL_STACK_SIZE,INCLUDE_uxTaskGetStackHighWaterMark,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configUSE_TIMERS,configTIMER_TASK_PRIORITY
FREERTOS.Tasks01=defaultTask,-3,1024,StartDefaultTask,As weak,NULL,Dynamic,NULL,NULL
FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1
FREERTOS.configENABLE_FPU=1
FREERTOS.configMINIMAL_STACK_SIZE=512
FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1
FREERTOS.configTIMER_TASK_PRIORITY=3
FREERTOS.configTOTAL_HEAP_SIZE=30000
FREERTOS.configUSE_COUNTING_SEMAPHORES=1
FREERTOS.configUSE_MALLOC_FAILED_HOOK=1

2
iflytop_canbus_protocol

@ -1 +1 @@
Subproject commit b0a5cf97b53f265eaaf0e3cf1e0aaa2364d2b358
Subproject commit fd05c9d4f6c74f29f550399ec3c238eab0295d37

6
usrc/service/config_service.cpp → usrc/base/config_service.cpp

@ -1,6 +1,6 @@
#include "config_service.hpp"
#include "project_dep.hpp"
#include "zsdk/zsdk.hpp"
static config_t _config;
static config_t _default_val_config;
@ -20,7 +20,7 @@ static void create_default_config(config_t *default_cfg) { //
void config_init(void) {
ZLOGI(TAG, "config_init");
// flash初始化
// flash锟斤拷始锟斤拷
_default_val_config.configMark = FLASH_MASK_VAL;
_default_val_config.placeHolder = 0;
@ -31,7 +31,7 @@ void config_init(void) {
zflash_factory_reset();
}
// 打印配置信
// 锟斤拷印锟斤拷锟斤拷锟斤拷
dump_config(&_config);
}
config_t *config_get(void) { return &_config; }

2
usrc/service/config_service.hpp → usrc/base/config_service.hpp

@ -7,7 +7,7 @@
typedef struct {
uint32_t configMark;
uint32_t placeHolder;
uint32_t checksum; // 不需要编辑
uint32_t checksum; //
} config_t;
void config_init(void);

11
usrc/base/device_info.cpp

@ -0,0 +1,11 @@
#include "device_info.hpp"
#include "iflytop_canbus_protocol/iflytop_canbus_protocol.hpp"
uint16_t deviceInfo_init() { return 0; }
uint16_t deviceInfo_getBoardId() { return DEVICE_ID; }
uint16_t deviceInfo_getProjectId() { return kdraw_bar_disinfection_box; }
uint16_t deviceInfo_getBoardType() { return kBoardType_LiquidCtrl; }
uint16_t deviceInfo_getProtocolVersion() { return PROTOCOL_VERSION; }
uint16_t deviceInfo_getSoftwareVersion() { return SOFTWARE_VERSION; }
uint16_t deviceInfo_getHardwareVersion() { return HARDWARE_VERSION; }

20
usrc/base/device_info.hpp

@ -0,0 +1,20 @@
#include <stddef.h>
#include <stdio.h>
#include "project_configs.h"
#include "base/config_service.hpp"
#include "zsdk/zsdk.hpp"
// uint16_t boardType;
// uint16_t projectId;
// uint16_t protcol_version;
// uint16_t software_version;
// uint16_t hardware_version;
uint16_t deviceInfo_init();
uint16_t deviceInfo_getBoardId();
uint16_t deviceInfo_getProjectId();
uint16_t deviceInfo_getBoardType();
uint16_t deviceInfo_getProtocolVersion();
uint16_t deviceInfo_getSoftwareVersion();
uint16_t deviceInfo_getHardwareVersion();

0
usrc/gpio_mgr.cpp

3
usrc/gpio_mgr.hpp

@ -1,3 +0,0 @@
#pragma once
namespace zwsd {
} // namespace zwsd

24
usrc/main.cpp

@ -1,7 +1,10 @@
#include <stddef.h>
#include <stdio.h>
#include "service/config_service.hpp"
#include "base/config_service.hpp"
#include "base/device_info.hpp"
#include "protocol_impl/protocol_impl_service.hpp"
#include "zsdk/zcanreceiver/zcanreceiver.hpp"
#include "zsdk/zsdk.hpp"
#define TAG "main"
@ -32,22 +35,23 @@ void debug_light_ctrl() {
}
void umain() {
int32_t count = 0;
ZLOGI(TAG, "%s: %d.%d.%d", PROJECT, VERSION_MAIN(PC_VERSION), VERSION_SUB(PC_VERSION), VERSION_FIX(PC_VERSION));
ZLOGI(TAG, "sn: %s", sn_get_str());
m_debugled.initAsOutput(DEBUG_LIGHT_GPIO, kxs_gpio_nopull, false, false);
config_init();
deviceInfo_init();
m_debugled.initAsOutput(DEBUG_LIGHT_GPIO, kxs_gpio_nopull, false, false);
ZLOGI(TAG, "%s ", PROJECT);
ZLOGI(TAG, "version : %d ", SOFTWARE_VERSION);
ZLOGI(TAG, "pversion: %d", deviceInfo_getProtocolVersion());
ZLOGI(TAG, "sn : %s", sn_get_str());
ZLOGI(TAG, "boardId : %d", deviceInfo_getBoardId());
ZLOGI(TAG, "system init done");
protocol_impl_service_init();
ZLOGI(TAG, "system init done");
SysMgr::ins()->regTaskId(osThreadGetId());
SysMgr::ins()->dumpSysInfo();
while (true) {
osDelay(10);
osDelay(1);
debug_light_ctrl();
}
}

8
usrc/project_configs.h

@ -1,9 +1,4 @@
#pragma once
#define VERSION(main, sub, fix) (main << 16 | sub << 8 | fix << 0)
#define VERSION_MAIN(version) ((version >> 16) & 0xFF)
#define VERSION_SUB(version) ((version >> 8) & 0xFF)
#define VERSION_FIX(version) ((version >> 0) & 0xFF)
/***********************************************************************************************************************
* PROJECT_CONFIG *
@ -13,7 +8,8 @@
* @brief
*
*/
#define PC_VERSION VERSION(1, 0, 0)
#define SOFTWARE_VERSION 1
#define HARDWARE_VERSION 1
#define PROJECT "dbdb_liquid_path_control"
#define SN_HEADER "SN"
#define DEVICE_ID (2)

3
usrc/project_dep.hpp

@ -1,3 +0,0 @@
#pragma once
#include "zsdk/zsdk.hpp"

74
usrc/protocol_impl/protocol_impl_service.cpp

@ -0,0 +1,74 @@
#include "protocol_impl_service.hpp"
#include "base/device_info.hpp"
#include "zsdk/zcanreceiver/zcanreceiver.hpp"
#define TAG "PROTO"
/***********************************************************************************************************************
* FUNCTION_LIST *
***********************************************************************************************************************/
/***********************************************************************************************************************
* VAR_LIST *
***********************************************************************************************************************/
static osTimerId HeartReportTimerId;
static osThreadId PacketRxThreadId;
/***********************************************************************************************************************
* FUNCTION_IMPL *
***********************************************************************************************************************/
static void zcanbus_on_rx(uint8_t from, uint8_t to, uint8_t* rawpacket, size_t len) { //
zcanbus_packet_t* packet = (zcanbus_packet_t*)rawpacket;
if (packet->function_id == kcmd_read_board_info) {
static ack_read_board_info_data_t ack;
ack.boardType = deviceInfo_getBoardType();
ack.projectId = deviceInfo_getProjectId();
ack.protcol_version = deviceInfo_getProtocolVersion();
ack.software_version = deviceInfo_getSoftwareVersion();
ack.hardware_version = deviceInfo_getHardwareVersion();
zcanbus_send_ack(packet, (uint8_t*)&ack, sizeof(ack));
}
}
static void zcanbus_on_connected(bool connected) {
if (connected) {
ZLOGI(TAG, "connected to host");
} else {
ZLOGI(TAG, "disconnected from host");
}
}
/***********************************************************************************************************************
* SCHEDULER *
***********************************************************************************************************************/
static void onHeartReportTimer(void const* argument) {
static report_heatpacket_data_t heatpacket;
heatpacket.boardType = deviceInfo_getBoardType();
zcanbus_send_report(kreport_heatpacket, (uint8_t*)&heatpacket, sizeof(heatpacket));
}
static void onPacketRxThreadStart(void const* argument) {
while (true) {
zcanbus_schedule();
osDelay(1);
}
}
/***********************************************************************************************************************
* EXT *
***********************************************************************************************************************/
void protocol_impl_service_init() { //
zcanbus_init(deviceInfo_getBoardId());
zcanbus_reglistener(zcanbus_on_rx);
zcanbus_reg_on_connected_listener(zcanbus_on_connected);
osTimerDef(HeartReportTimer, onHeartReportTimer);
HeartReportTimerId = osTimerCreate(osTimer(HeartReportTimer), osTimerPeriodic, NULL);
osTimerStart(HeartReportTimerId, HEART_PACKET_PERIOD_MS);
osThreadDef(PacketRxThread, onPacketRxThreadStart, osPriorityNormal, 1024, NULL);
PacketRxThreadId = osThreadCreate(osThread(PacketRxThread), NULL);
}

10
usrc/protocol_impl/protocol_impl_service.hpp

@ -0,0 +1,10 @@
#include <stddef.h>
#include <stdio.h>
#include "base/config_service.hpp"
#include "zsdk/zsdk.hpp"
void protocol_impl_service_init();
// void zcanbus_on_rx(uint8_t from, uint8_t to, uint8_t *packet, size_t len);
// void zcanbus_on_connected(bool connected);

2
zsdk

@ -1 +1 @@
Subproject commit dd7948a6ee79997de985c1d8c3b4afd75bc40947
Subproject commit 87de1df69a31ca63c98db607ba3851f3e201c857
Loading…
Cancel
Save