初始化曝光时间15ms

This commit is contained in:
2025-03-05 15:07:16 +08:00
parent cde431e41c
commit 4aa9b8e785
9 changed files with 2872 additions and 2863 deletions

View File

@ -23,7 +23,7 @@ uint32_t Receive_Data_Count = 0;
uint32_t Last_Receive_Data_Count = 0; uint32_t Last_Receive_Data_Count = 0;
uint32_t shutter_time = 20; uint32_t shutter_time = 20;
uint32_t mode = 0; uint32_t mode = 1;
float Temperature = 0; float Temperature = 0;
/* Send_Data_Type /* Send_Data_Type
* 0 发送原始数据 * 0 发送原始数据
@ -32,7 +32,7 @@ float Temperature = 0;
* 3 发送多次均数据 * 3 发送多次均数据
* 4 发送滑动平均数据 * 4 发送滑动平均数据
*/ */
uint32_t Send_Data_Type = 0; uint8_t Send_Data_Type = 0;
uint32_t sn = 1699; uint32_t sn = 1699;
void Communication_Init() { void Communication_Init() {
@ -78,7 +78,7 @@ void mymain()
// __HAL_UART_DISABLE(&huart2); // __HAL_UART_DISABLE(&huart2);
// HAL_UART_Receive_DMA(&huart2, (uint8_t *)USART2_RX_Buffer, USART2_RX_BUFFER_SIZE*2); // HAL_UART_Receive_DMA(&huart2, (uint8_t *)USART2_RX_Buffer, USART2_RX_BUFFER_SIZE*2);
// USART2->CR3 |= USART_CR3_DMAT; // 启用DMA传输 // USART2->CR3 |= USART_CR3_DMAT; // 启用DMA传输
Send_Shutter_Time(15);
// LED_OFF; // LED_OFF;
// // HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2,0); // // HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2,0);
@ -127,9 +127,9 @@ void mymain()
} }
} }
//按命令发送数据 //按命令发送数据
if((Send_Data_Type & 0x8000) !=0) if((Send_Data_Type & 0x80) !=0)
{ {
Send_Data_Type = Send_Data_Type & 0x7FFF; Send_Data_Type = Send_Data_Type & 0x7F;
uint16_t sgi_result[USART2_RX_BUFFER_SIZE]; uint16_t sgi_result[USART2_RX_BUFFER_SIZE];
// printf("AAA"); // printf("AAA");
switch (Send_Data_Type) switch (Send_Data_Type)
@ -152,7 +152,7 @@ void mymain()
Send_Data(0x61,(uint8_t *)Moving_Average_Buffer,515*2); Send_Data(0x61,(uint8_t *)Moving_Average_Buffer,515*2);
break; break;
} }
Send_Data_Type = Send_Data_Type & 0x7FFF; Send_Data_Type = Send_Data_Type & 0x7F;
} }
// if ( a == 1300 * 15) { // if ( a == 1300 * 15) {
// Temperature = DS18B20_GetTemperature(); // Temperature = DS18B20_GetTemperature();
@ -198,8 +198,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
void commander_run(void) void commander_run(void)
{ {
if(g_usart_rx_sta > 7) if(g_usart_rx_sta > 7)
{ {
uint16_t data_length = g_usart_rx_sta & 0x3fff; uint16_t data_length = g_usart_rx_sta & 0x3fff;
@ -246,16 +244,16 @@ void commander_run(void)
} }
//获取曝光时间 //获取曝光时间
case 0x53:{ case 0x53:{
uint8_t st[5]; uint8_t st[4];
// memcpy(st,&shutter_time,4); // memcpy(st,&shutter_time,4);
st[3] = shutter_time & 0xff; st[3] = shutter_time & 0xff;
st[2] = (shutter_time >> 8) & 0xff; st[2] = (shutter_time >> 8) & 0xff;
st[1] = (shutter_time >> 16) & 0xff; st[1] = (shutter_time >> 16) & 0xff;
st[0] = (shutter_time >> 24) & 0xff; st[0] = (shutter_time >> 24) & 0xff;
st[4] = Send_Data_Type & 0x7FFF;
// printf("shutter_time %d\n",shutter_time); // printf("shutter_time %d\n",shutter_time);
Send_Data(0x53,st,5); Send_Data(0x53,st,4);
break; break;
} }
//获取温度 //获取温度
@ -293,7 +291,12 @@ void commander_run(void)
} }
//获取数据 //获取数据
case 0x61: { case 0x61: {
Send_Data_Type = Send_Data_Type | 0x8000; Send_Data_Type = Send_Data_Type | 0x80;
break;
}
case 0x62: {
uint8_t d = Send_Data_Type & 0x7F;
Send_Data(0x62,&d,1);
break; break;
} }

View File

@ -44,3 +44,7 @@
4 226 7616494845597149 CMakeFiles/H750_S15909.elf.dir/APP/communication.c.obj a5671d3e902ec96e 4 226 7616494845597149 CMakeFiles/H750_S15909.elf.dir/APP/communication.c.obj a5671d3e902ec96e
8 247 7616494845636737 CMakeFiles/H750_S15909.elf.dir/APP/mymain.c.obj 122368a4a11394d9 8 247 7616494845636737 CMakeFiles/H750_S15909.elf.dir/APP/mymain.c.obj 122368a4a11394d9
247 547 7616494848033254 H750_S15909.elf 241449077da76be9 247 547 7616494848033254 H750_S15909.elf 241449077da76be9
13 587 7628611721940593 CMakeFiles/H750_S15909.elf.dir/APP/mymain.c.obj 122368a4a11394d9
588 930 7628611727679501 H750_S15909.elf 241449077da76be9
4 234 7628614515700357 CMakeFiles/H750_S15909.elf.dir/APP/mymain.c.obj 122368a4a11394d9
235 537 7628614517998877 H750_S15909.elf 241449077da76be9

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
readme/~$S3通讯协议.doc Normal file

Binary file not shown.