anchor.diff:  	(if (or (= ostype "Win32") (= ostype "Cygwin")) ;;ָ
   		(setq serial_port_setting (string "stty -F " dev_str " cs8 " baud " -ixon -icanon  min 0 time 30") )
   		;(setq serial_port_setting (string "stty -F " dev_str " cs8 " baud " -ignbrk -brkint -igncr ignpar -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh   min 150 time 1"))
  -		(setq serial_port_setting (string "stty -F " dev_str " cs8 " baud " raw min 150 time 1"))
  +		(setq serial_port_setting (string "stty -F " dev_str " cs8 " baud " raw min 250 time 3")) ;; 300ms timeout,timeoutԽһοԶԽ֮࣬ʱҲҪĸtimeout
   	)
   	(exec serial_port_setting)
   )
  
positive.code: 	(new Tree 'BASE);ԣԶִеõϢĹ
  )
  
  (define (hextostring hex_buf); xxxxxxx to xx xx xx xx
  	(setq nr (length hex_buf))
  	(assert "hextostring length: " nr "\n")
  	(setq ret nil)
  	(setq dupstr (dup "b " nr))
  	
  
negative.code: 	
  	
  	(while (< pos len)
  		
  			(if 
  				(and (< pos len) (= (char (nth pos data))  0x06) (< (+ pos 2) len)) ;; panidӺopenwrtŵzigbee
  				(begin
  					(setq panid (format "%04X" (get-int (reverse (slice data (+ pos 1) 2)))))
  					(if (not (nil? (BASE "PANID")))
  							(BASE "PANID2" panid)
  							(BASE "PANID"  panid)
  					)
  					(share base_in_mem (BASE))
  					(setq pos (+ pos 3))
  				)
  				(and (< pos len) (= (char (nth pos data))  0xa0) (< (+ pos 4) len)) ;; ¶,ҳȳǰλ 2 λ
  				(begin
  					(setq tmp nil)
  					(setq short_address nil)
  					(setq short_address (slice (format "%04X" (get-int (reverse (slice data (+ pos 1) 2)))) 0 4))
  					
  					;(setq tmp (| (<< (char (nth (+ pos 3) data) ) 8 ) (char (nth (+ pos 4) data) ) ) )
  					(setq tmp (get-int (slice data 2 2)))
  					(BASE (string  short_address "_TEMP") (int tmp))
  					(save "base.lsp" 'BASE)
  					(share base_in_mem (BASE))
  					(setq pos (+ pos 5))
  				)
  				(and (< pos len) (= (char (nth pos data))  0xa1) (< (+ pos 4) len)) ;; ¶,ҳȳǰλ 2 λ
  				(begin
  					(setq tmp nil)
  					(setq short_address nil)	
  					(setq short_address (format "%04X" (get-int (reverse (slice data (+ pos 1) 2)))))
  					(setq tmp (get-int (reverse (slice data 2 2))))
  					(BASE (string  (slice short_address 0 4) "_HUMI") (int tmp));; humidity 
  					(share base_in_mem (BASE))
  					(setq pos (+ pos 5))
  				)
  					
  			(and (< pos len) (= (char (nth pos data))  0x02) (< (+ pos 10) len)) ;;;ȡӽڵ̵ַ0x02 xx xx mm mm mmm mmmmmmmmmm.,0x02+̵ַ+Macַ
  			(begin
  				(setq short_address nil)
  				(setq short_address (format "%04X" (get-int (reverse (slice data (+ pos 1) 2)))))
  				(setq mac_address (hextostring (slice data (+ pos 3) 8))) 
  				(setq sa_string (slice short_address 0 4))
  				(setq ma_string (slice mac_address 0 8))
  				
  				(if (nil? (BASE "NODES"))
  					(begin
  						(BASE "NODES" (list (list ma_string (list "shortaddress" sa_string))))
  						(share base_in_mem (BASE))
  					)
  					(not (nil? (BASE "NODES")))
  					(begin
  						(setq was_find -1)
  						(setq match_ele nil)
  						(dolist (w (BASE "NODES") (if (find ma_string w) (begin (setq match_ele w) (setq  was_find $idx))) ) )
  							
  						(if (= was_find -1)
  							(begin
  								(push (list ma_string  (list "shortaddress" sa_string)) (BASE "NODES"))
  								(while (!= (length (share base_in_mem)) (length (BASE)) )
  										(share base_in_mem (BASE))
  								)
  							)
  							(> was_find -1);; 豸ڹ
  							(begin
  								(if (not (nil? match_ele))
  									(begin
  										(dolist (w match_ele) (if (find "shortaddress") (setq (nth $idx (nth was_find (BASE "NODES"))) (list "shortaddress" sa_string))))
  										(while (!= (length (share base_in_mem)) (length (BASE)) )
  											(share base_in_mem (BASE))
  										)
  									)
  								)
  							)
  						)
  						(setq was_find -1)
  						(setq match_ele nil)
  					)
  				)
  				(setq pos (+ pos 11))
  				(setq sa_string nil) (setq ma_string nil)
  			)
  			
  			(and (< pos len) (= (char (nth pos data))  0xa6) (< (+ pos 6) len)) ;;; ȡpm25 a8 xx xx cc cc dd dd, c d is low and counter
  			(begin
  				(setq short_address nil)
  				(setq short_address (slice (format "%04X" (get-int (reverse (slice data (+ pos 1) 2)))) 0 4))
  				(setq tmp1 (get-int (reverse (slice data 3 2))))
  				(setq tmp2 (get-int (reverse (slice data 5 2))))
  				(setq pm25_ratio (div tmp1 tmp2))
  				(if (<= pm25_ratio 0.008)
  						(setq tmp 0)
  