Commit 76c2df7b authored by 957dd's avatar 957dd

更改了url

parent 90a92785
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(car project(car
VERSION 1.2.15 VERSION 1.2.16
LANGUAGES C LANGUAGES C
) )
......
...@@ -94,7 +94,7 @@ int hash_insert_init(HashTable_t *HashTable_t) { ...@@ -94,7 +94,7 @@ int hash_insert_init(HashTable_t *HashTable_t) {
insert(HashTable_t, "0201", TANK_0201); insert(HashTable_t, "0201", TANK_0201);
insert(HashTable_t, "0202", TANK_0202); insert(HashTable_t, "0202", TANK_0202);
insert(HashTable_t, "0203", TANK_0203); insert(HashTable_t, "0203", TANK_0203);
insert(HashTable_t, "0204", TANK_0203); insert(HashTable_t, "0204", TANK_0204);
insert(HashTable_t, "0206", TANK_0206); insert(HashTable_t, "0206", TANK_0206);
insert(HashTable_t, "0301", SHIP_0301); insert(HashTable_t, "0301", SHIP_0301);
insert(HashTable_t, "0401", PAO_0401); insert(HashTable_t, "0401", PAO_0401);
......
#define PROJECT_VERSION_MAJOR 1 #define PROJECT_VERSION_MAJOR 1
#define PROJECT_VERSION_MINOR 2 #define PROJECT_VERSION_MINOR 2
#define PROJECT_VERSION_PATCH 15 #define PROJECT_VERSION_PATCH 16
#define GIT_HASH "" #define GIT_HASH ""
#define BUILD_TIMESTAMP "" #define BUILD_TIMESTAMP ""
#define BUILD_USER "" #define BUILD_USER ""
No preview for this file type
...@@ -69,77 +69,90 @@ void tank0204_mode_right_flont(unsigned char gval) { ...@@ -69,77 +69,90 @@ void tank0204_mode_right_flont(unsigned char gval) {
} }
} }
void tank0204_change(unsigned char *buf) { int tank0204_change_grading(int mode){
int mode_val=0;
switch(mode){
case 2:
mode_val=10;
break;
case 3:
mode_val=20;
break;
case 4:
mode_val=30;
break;
case 5:
mode_val=50;
break;
default:
break;
}
return mode_val;
}
void tank0204_change(unsigned char *buf) {
unsigned char type = buf[0];
unsigned char mode = buf[1]; unsigned char mode = buf[1];
unsigned char val = buf[2]; unsigned char val = buf[2];
static int modecount_tank0203=0;
static int tank0203_index =0; static int tank0204_steering_t=0;
// static int s_val_1=0; static int tank0204_front_t =0;
// static int s_val_2=0;
static int tank0204_front_val=0;
static int tank0204_steering_val=0;
if(mode == 1 ) { int tank0204_count=40;
tank0204_mode_lift_flont(val);
tank0204_mode_right_flont(val);
modecount_tank0203=0;
//s_val_1 = val;
}else if(mode == 2 ) {
tank0204_mode_lift_back(val);
tank0204_mode_right_back(val);
modecount_tank0203=1;
//s_val_2 = val;
}
if((mode == 1||mode == 2)&&val == 0) {
modecount_tank0203 = 0;
tank0203_index = 0;
}
if((mode == 1||mode == 2)&&val != 0) tank0203_index = 1;
if(mode == 3) { if(type != 1) tank0204_count=tank0204_change_grading(type);
if(modecount_tank0203 == 0){
if(tank0203_index == 1) {
tank0204_mode_lift_flont(0);
//tank0204_mode_right_flont(s_val_1-20);
}
else {
tank0204_mode_lift_back(val+30);
tank0204_mode_right_flont(val+30);
}
}
if(modecount_tank0203 == 1) {
if(tank0203_index == 1) {
tank0204_mode_lift_back(0);
//tank0204_mode_lift_back(s_val_2-20);
}else {
tank0204_mode_lift_back(val+30);
tank0204_mode_right_flont(val+30);
}
}
}else if(mode == 4) { if((mode == 1 ||mode == 2)&&val == 0) tank0204_front_t =0;
if(modecount_tank0203 == 1){ if((mode == 3 ||mode == 4)&&val == 0) tank0204_steering_t=0;
if(tank0203_index == 1) {
//tank0204_mode_right_back(s_val_1);
tank0204_mode_right_back(0);
}
else {
tank0204_mode_lift_flont(val+30);
tank0204_mode_right_back(val+30);
}
} if(mode == 1&&val != 0) {
if(modecount_tank0203 == 0) { tank0204_front_val=val;
if(tank0203_index == 1) { tank0204_front_t =1;
//tank0204_mode_lift_flont(s_val_1-20); }else if(mode == 2&&val != 0) {
tank0204_mode_right_flont(0); tank0204_front_t =2;
} tank0204_front_val=val;
else { }
tank0204_mode_lift_flont(val+30);
tank0204_mode_right_back(val+30);
}
}
} if(mode == 3&&val != 0) {
tank0204_steering_t =1;
tank0204_steering_val = val;
}else if(mode == 4&&val != 0) {
tank0204_steering_t =2;
tank0204_steering_val = val;
}
if(tank0204_front_t ==0&&tank0204_steering_t==0){
tank0204_mode_lift_flont(0);
tank0204_mode_right_flont(0);
}else if(tank0204_front_t ==1&&tank0204_steering_t==0){
tank0204_mode_right_flont(tank0204_front_val+10);
tank0204_mode_lift_flont(0);
}else if(tank0204_front_t ==2&&tank0204_steering_t==0){
tank0204_mode_right_back(tank0204_front_val+10);
tank0204_mode_lift_back(0);
}else if(tank0204_front_t ==0&&tank0204_steering_t==1){
tank0204_mode_lift_back(tank0204_steering_val + tank0204_count+20);
tank0204_mode_right_back(0);
}else if(tank0204_front_t ==0&&tank0204_steering_t==2){
tank0204_mode_lift_flont(tank0204_steering_val + tank0204_count+20);
tank0204_mode_right_back(0);
}
else if(tank0204_front_t ==1&&tank0204_steering_t==1){
tank0204_mode_lift_back(tank0204_steering_val + 10);
tank0204_mode_right_flont(tank0204_steering_val + 20);
}else if(tank0204_front_t ==1&&tank0204_steering_t==2){
tank0204_mode_lift_flont(tank0204_steering_val +10);
tank0204_mode_right_flont(tank0204_steering_val + 20);
}else if(tank0204_front_t ==2&&tank0204_steering_t==1){
tank0204_mode_lift_back(tank0204_steering_val + 10);
tank0204_mode_right_back(tank0204_steering_val + 20);
}else if(tank0204_front_t ==2&&tank0204_steering_t==2){
tank0204_mode_lift_flont(tank0204_steering_val + 10);
tank0204_mode_right_back(tank0204_steering_val + 20);
}
} }
...@@ -106,8 +106,8 @@ const deviceconfig_t device_configs[] = { ...@@ -106,8 +106,8 @@ const deviceconfig_t device_configs[] = {
{ {
.device_id = DEVICE_ROBOT_DOG0501, .device_id = DEVICE_ROBOT_DOG0501,
.device_name = "dog0501", .device_name = "dog0501",
.gpio_pins = {5, 6, 7, 10, 16, 20, 22, 23, 24, 25, 26,-1},/* 补充GPIO引脚 */ .gpio_pins = {6, 10, 16, 20, 22, 23, 25,-1},/* 补充GPIO引脚 */
.gpio_pwms = { 27,-1}, .gpio_pwms = { 5, 7,24, 26,27,-1},
.device_pwm_init = physics_pwm_init, .device_pwm_init = physics_pwm_init,
.device_control_stop = car0101_middle_pwm,/* 补充速度控制函数 */ .device_control_stop = car0101_middle_pwm,/* 补充速度控制函数 */
.emergency_code = 501 .emergency_code = 501
......
...@@ -352,7 +352,7 @@ void tank0202_pwm_value(int pin,int value) { //软件陪我们控制调速 ...@@ -352,7 +352,7 @@ void tank0202_pwm_value(int pin,int value) { //软件陪我们控制调速
if(pin == 27){ if(pin == 27){
device_shoting_check(27,30); device_shoting_check(27,30);
} else { } else {
softPwmWrite(pin, 40); softPwmWrite(pin, 30);
my_zlog_info("pwm:%d",pin); my_zlog_info("pwm:%d",pin);
} }
...@@ -377,7 +377,7 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速 ...@@ -377,7 +377,7 @@ void tank0203_pwm_value(int pin,int value) { //软件陪我们控制调速
if(pin == 27){ if(pin == 27){
device_shoting_check(27,30); device_shoting_check(27,30);
} else { } else {
softPwmWrite(pin, 35); softPwmWrite(pin, 30);
my_zlog_info("pwm:%d",pin); my_zlog_info("pwm:%d",pin);
} }
...@@ -402,7 +402,7 @@ void tank0204_pwm_value(int pin,int value){ ...@@ -402,7 +402,7 @@ void tank0204_pwm_value(int pin,int value){
if(pin == 27){ if(pin == 27){
device_shoting_check(27,30); device_shoting_check(27,30);
} else { } else {
softPwmWrite(pin, 35); softPwmWrite(pin, 30);
my_zlog_info("pwm:%d",pin); my_zlog_info("pwm:%d",pin);
} }
...@@ -478,14 +478,18 @@ void dog0501_pwm_value(int pin,int value) { //软件陪我们控制调速 ...@@ -478,14 +478,18 @@ void dog0501_pwm_value(int pin,int value) { //软件陪我们控制调速
if(value==1) { if(value==1) {
if(pin == 27){ if(pin == 27){
softPwmWrite(pin, 90); softPwmWrite(27, 40);
softPwmWrite(7, 80);
} else { } else {
softPwmWrite(pin, 35); softPwmWrite(pin, 35);
my_zlog_info("pwm:%d",pin); my_zlog_info("pwm:%d",pin);
} }
}else if(value==0) { }else if(value==0) {
softPwmWrite(pin, 0); if(pin==27){
softPwmWrite(27, 0);
softPwmWrite(7, 0);
}else softPwmWrite(pin, 0);
my_zlog_info("pwm:%d,0",pin); my_zlog_info("pwm:%d,0",pin);
} }
my_zlog_info("dog0501 pwm"); my_zlog_info("dog0501 pwm");
......
...@@ -6,7 +6,7 @@ double tank_angle(){ ...@@ -6,7 +6,7 @@ double tank_angle(){
double angle=0; double angle=0;
float angle_shot=ads1115_read_channel(2); float angle_shot=ads1115_read_channel(2);
if(angle_shot>0){ if(angle_shot>0){
angle_shot=angle_shot*360/5; angle_shot=angle_shot*360/5.05;
angle = round(angle_shot * 100) / 100; angle = round(angle_shot * 100) / 100;
} }
...@@ -23,4 +23,19 @@ int angle_limit(){ ...@@ -23,4 +23,19 @@ int angle_limit(){
return 0; return 0;
}else return 0; }else return 0;
} }
\ No newline at end of file
// double angle_ema_filter(double filtered, double raw, double alpha, double deadband) {
// filtered = wrap_deg(filtered);
// raw = wrap_deg(raw);
// double diff = shortest_angle_diff(filtered, raw); // 从 filtered 指向 raw 的差
// if (fabs(diff) <= deadband) {
// // 抖动范围内,不更新
// return filtered;
// }
// // 角度版 EMA:沿最短方向移动 alpha * diff
// double new_filtered = filtered + alpha * diff;
// return wrap_deg(new_filtered);
// }
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
- car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右 - car0103 为挖机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- car0104 为推土机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右 - car0104 为推土机 最大速度为200,更据电池电压具体调速。原电池为7.6v,大概为140左右
- ptz0401 为炮台,有限位。 - ptz0401 为炮台,有限位。
- 0501 为机械狗
## 国内国外二进制介绍 ## 国内国外二进制介绍
- mqtt_init.h改变里面的一个MQTT_IPMODE,游览器改变browser_open.h中的BROWSER_MODE - mqtt_init.h改变里面的一个MQTT_IPMODE,游览器改变browser_open.h中的BROWSER_MODE
\ No newline at end of file
...@@ -61,7 +61,7 @@ int parse_device_config(const char *json_str) { ...@@ -61,7 +61,7 @@ int parse_device_config(const char *json_str) {
} }
// 4. 提取 api 和 videoUrl // 4. 提取 api 和 videoUrl
cJSON *videoUrl = cJSON_GetObjectItemCaseSensitive(data, "videoUrl"); cJSON *videoUrl = cJSON_GetObjectItemCaseSensitive(data, "videoUrlForDevice");
if (cJSON_IsString(videoUrl)) { if (cJSON_IsString(videoUrl)) {
my_zlog_debug("视频地址: %s", videoUrl->valuestring); my_zlog_debug("视频地址: %s", videoUrl->valuestring);
......
#include "mqtt_infor_handle.h" #include "mqtt_infor_handle.h"
#include "mqtt_init.h" #include "mqtt_common.h"
#include "ip_reader.h"
#include "mqtt_verify.h"
#include "device_fileopen.h"
#include "device_identity.h"
#include "browser_open.h"
#include "temperature.h"
#include "common.h" #include "common.h"
#include "INA226.h" #include "app_device_common.h"
#include "ads1115.h" #include "drivers_common.h"
#include "warn.h" #include "modules_common.h"
#include "device_fileopen.h"
#include "devcontrol_common.h"
#include "device_wifi_change.h"
#include "device_wifi_manager.h"
#include "device_id_change.h"
#include "audioplay.h"
#include "gpio_init.h"
#include "device_init.h"
#include "tank_angle.h"
#include "gpio_control.h"
#include "http_consolepush.h"
#include "http_config_mqtt.h"
int g_heartbeat_count=0; int g_heartbeat_count=0;
...@@ -82,7 +64,6 @@ void heartbeat_send() { ...@@ -82,7 +64,6 @@ void heartbeat_send() {
mosquitto_publish(g_clients_t[i].mosq, NULL, mqtt_topic_dev2app_number(), strlen(payload), payload, 0, false); mosquitto_publish(g_clients_t[i].mosq, NULL, mqtt_topic_dev2app_number(), strlen(payload), payload, 0, false);
mosquitto_publish(g_clients_t[i].mosq, NULL, mqtt_topic_pure_number(), strlen(payload), payload, 0, false); mosquitto_publish(g_clients_t[i].mosq, NULL, mqtt_topic_pure_number(), strlen(payload), payload, 0, false);
} }
cJSON_Delete(root); // 释放 cJSON 对象 cJSON_Delete(root); // 释放 cJSON 对象
} }
...@@ -90,7 +71,6 @@ void heartbeat_send() { ...@@ -90,7 +71,6 @@ void heartbeat_send() {
//角度发送 //角度发送
void angle_mqtt_send() { void angle_mqtt_send() {
static int angle_i=0; static int angle_i=0;
static double record_angle_t=0;
cJSON *root = cJSON_CreateObject(); cJSON *root = cJSON_CreateObject();
char TOPIC_send_angle[26]; char TOPIC_send_angle[26];
double rounded_angle = tank_angle(); double rounded_angle = tank_angle();
...@@ -103,15 +83,12 @@ void angle_mqtt_send() { ...@@ -103,15 +83,12 @@ void angle_mqtt_send() {
my_zlog_debug("%s",payload); my_zlog_debug("%s",payload);
angle_i=0; angle_i=0;
} }
if(fabs(rounded_angle - record_angle_t) >3){
for(int i=0;i<g_mqtt_cam_config_t->mqtt_count;i++){
mosquitto_publish(g_clients_t[i].mosq, NULL, TOPIC_send_angle, strlen(payload), payload, 0, false);
}
}
record_angle_t=rounded_angle; for(int i=0;i<g_mqtt_cam_config_t->mqtt_count;i++){
cJSON_Delete(root); // 释放 cJSON 对象 mosquitto_publish(g_clients_t[i].mosq, NULL, TOPIC_send_angle, strlen(payload), payload, 0, false);
}
cJSON_Delete(root); // 释放 cJSON 对象
} }
//心跳格式,每5s一次心跳 //心跳格式,每5s一次心跳
...@@ -131,7 +108,6 @@ void mqtt_beat_wirte(){ ...@@ -131,7 +108,6 @@ void mqtt_beat_wirte(){
default: default:
break; break;
} }
} }
//message_type为3,控制pwm //message_type为3,控制pwm
......
...@@ -12,14 +12,13 @@ char g_uuid_mqtt_topic_id[MAX_SERVERS][56]; ...@@ -12,14 +12,13 @@ char g_uuid_mqtt_topic_id[MAX_SERVERS][56];
int add_mqtt_create(const char *host, int port, int clients_count); int add_mqtt_create(const char *host, int port, int clients_count);
//mqtt初始化 //mqtt初始化
int mqtt_init() { int mqtt_init() {
mosquitto_lib_init(); mosquitto_lib_init();
// 这里创建mosq可以保留,也可以删除这一行,让创建放到 Mqtt_onnect 里 // 这里创建mosq可以保留,也可以删除这一行,让创建放到 Mqtt_onnect 里
for(int i=0;i<g_mqtt_cam_config_t->mqtt_count;i++){ for(int i=0;i<g_mqtt_cam_config_t->mqtt_count;i++){
int erg= add_mqtt_create(g_mqtt_cam_config_t->mqtt_servers[i],BROKER_PORT,i); int erg= add_mqtt_create(g_mqtt_cam_config_t->mqtt_servers[i],BROKER_PORT,i);
if(erg !=0){ if(erg !=0){
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment