You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

168 lines
3.7 KiB

////////////////////////////////////////////////////////////////////////////
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
///-------------------------------------------------------------------------
/// @file algorithm.h
/// @brief bsp @ driver config
///-------------------------------------------------------------------------
/// @version 1.0
/// @author CC
/// @date 20180331
/// @note cc_AS_stc02
///
///
///algorithm///英 [??lg?r?e?m] 美 [??l???r?e?m] ///n.演算法;运算法则;计算程序
///
///
///
//////////////////////////////////////////////////////////////////////////////
#ifndef _APP_algorithm_H
#define _APP_algorithm_H
#include "../clib/Type.h"
#include "../ctask/task.h"
#include "../msp/uart0.h"
#include "../clib/clib.h"
//#include "../debug/debug_drv.h"//
//#include "../msp/msp_plcd.h"
//#include "../msp/SHC6601_rtc.h"
///#include "app_rf.h"
//#include "app_as.h"
#include "../tpc/tpc_uart.h"
//>>>>>>>>>>>>>>>>>>>>>0开机task
#define D_task_ALGO_median 0x51
#define D_task_ALGO_wait 0x52
#define D_task_ALGO_cal 0x53
#define D_task_ALGO_updown 0x54
#define D_task_ALGO_section 0x57
#define D_task_ALGO_cali_mode 0x63
#define D_task_ALGO_para 0x64
#define D_task_ALGO_200in 0x66
#define D_task_ALGO_cali_end 0x69
#define D_task_ALGO_cali_wait 0x70
#define D_task_ALGO_cali_save 0x73
#define D_task_ALGO_sa 0x6b
#define D_line_sum 1000 ///判定白屏的阀值
typedef struct
{
TS_task task;
vU16 usSum;
vU16 ustMP;
vU16 usPaper150;
vU16 usPaperNum;
// vU32 ul2;
// vU32 ul3;
// vU16 t;
/// vU16 usSum_temp;
// vU16 usSum100;
// vU16 usLong; /// 白区长度
/// vU8 *p_buf2;//
vU8 usPaperSection; ///纸张的段数
vU8 cali_delay;
vU8 cali_timer;
vU8 cali_over;
vU8 cali_hit;
vU8 hit_ok:1;
vU8 ok:1;
vU8 cali_mode:1; //D_OK
vU8 ok2:1;
vU8 paperMode:3;//
// vU8 buf3[520];//
}TS_task_ALGO_;
extern TS_task_ALGO_ ts_task_ALGO;
extern void L2_task_ALGO_handle(TS_task_ALGO_ *s);
extern void L2_task_ALGO_init(void);
extern void L2_task_ALGO_handle22(TS_task_ALGO_ *s);
/***********************
10 0.93
20张 1.88mm --->0.094mm/paper
100 9.4 2.97mm-> 31.59574468
150 14.1 15.9---> 169.1489362 2330 0x0924
200 18.8 0
****************/
#define D_paper_EE 0x0B10 ///0b1f
#define D_paper_MAX 0x09AA ///2555 //170张
#define D_paper_150LR 250 ///上下浮动值 大概150/15 =10页
#define D_paper_150at 0x087f ///150张校准 2330/150 = 15point/张纸
#define D_paper_00 0x0015
#define D_paper_150at_top (D_paper_150at + D_paper_150LR)
#define D_paper_150at_bottom (D_paper_150at - D_paper_150LR)
#define D_cam_EE 0
#define D_cam_top 1
#define D_cam_150at 2
#define D_cam_00 3
#define D_cam_erro 4
#define D_cam_noee 5
//<<<<<<<<<<<<<<<<<<<0开机task
#if 0
#define PrintAlgo_L0_uart0_uchex(x) L0_uart0_uchex((x))
#define PrintAlgo_L0_uart0_uc(x) L0_uart0_uc((x))
#define PrintAlgo_D_send_us(x) D_send_ushex((x))
#define PrintAlgo_str(x,len) L0_uart0_sendArray((x),len)
#else
#define PrintAlgo_L0_uart0_uchex(x)
#define PrintAlgo_L0_uart0_uc(x)
#define PrintAlgo_D_send_us(x)
#define PrintAlgo_str(x,len)
#endif
/************************************************************
/// 去尖峰 削波
/// ______/\___________
/// / \
/// / ...............................\--high
/// / \
/// / \
/// / low \---low
///-16 17-- \
///
*******************************************/
#define D_F_low 23
#define D_F_high 30
#define D_F_diff 5 //D_F_high - D_F_low
///#define D_F_diff (D_F_high - D_F_low)
#endif //_APP_algorithm_H ALGO