Skip to content

Commit

Permalink
Merge ae519e3 into 56f9b14
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiu-xiao authored Apr 26, 2023
2 parents 56f9b14 + ae519e3 commit 3a6cf59
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(CMAKE_ASM_FLAGS_RELEASE "-O3 -g")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
add_compile_definitions(MCU_DEBUG_BUILD USE_FULL_ASSERT)
add_compile_options(-Werror -gdwarf-4)

elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS_RELEASE "-O3")
Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/raspi_4b_with_ch348/drivers/bsp_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void bsp_uart_init() {
tty_cfg.c_cflag &= ~CSTOPB;
tty_cfg.c_cflag &= ~CRTSCTS;

cfsetispeed(&tty_cfg, B3500000);
cfsetospeed(&tty_cfg, B3500000);
cfsetispeed(&tty_cfg, B2000000);
cfsetospeed(&tty_cfg, B2000000);

// 一般必设置的标志
tty_cfg.c_cflag |= (CLOCAL | CREAD);
Expand Down
2 changes: 2 additions & 0 deletions hw/mcu/linux/add_exec_path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sudo ln -s build/xrobot.elf /usr/bin/xrobot
14 changes: 14 additions & 0 deletions hw/mcu/linux/add_systemd_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
sudo echo "[Unit]
Description=XRobot Service
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=bash -c \"export HOME=${HOME} && nohup /usr/bin/xrobot > null\"
ExecReload=bash -c \"export HOME=${HOME} && nohup /usr/bin/xrobot > null\"
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/xrobot.service
6 changes: 4 additions & 2 deletions src/module/uart_udp/mod_uart_udp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class UartToUDP {
} Param;

UartToUDP(Param& param) {
for (int i = 0; i < BSP_UART_NUM; i++) {
udp_rx_sem_[i] = new System::Semaphore(false);
}

bsp_udp_server_init(&udp_server_, param.port);

auto udp_rx_cb = [](void* arg, void* buff, uint32_t size) {
Expand Down Expand Up @@ -107,8 +111,6 @@ class UartToUDP {
};

for (int i = 0; i < BSP_UART_NUM; i++) {
udp_rx_sem_[i] = new System::Semaphore(false);

uart_tx_thread_[i].Create(
uart_tx_thread_fn, this,
(std::string("uart_to_udp_tx_") + std::to_string(i)).c_str(), 512,
Expand Down

0 comments on commit 3a6cf59

Please sign in to comment.