You may need to be added as a committer. What is your GitHub user ID?

Sent from my iPhone

On Jun 22, 2017, at 9:24 AM, Eur van Andel 
<[email protected]<mailto:[email protected]>> wrote:

Hi Jallibbers

It has been a long time since I committed.

I tried to commit a PMS3003 dust sensor lib and sample but failed:

svn: E175013: Commit failed (details follow):
svn: E175013: Access to 
'/jallib/jallib.git/!svn/act/a88c364a-6133-4287-a05a-5c4a7871d67c' forbidden
svn: E175013: Your commit message was left in a temporary file:
svn: E175013:    '/Users/eur/github/jallib.git/svn-commit.2.tmp'

For reference, I pasted the sample and lib below. I validated both files. If I 
may, I can commit some more stuff that I am working on:

- periodic library for dining stuff every x seconds/minutes/hours, even 
milliseconds
- MH-Z19B CO2 sensor, including calibration
- T6713 I2C CO2 sensor
- RN1810 wireless module
- HIH Honeywell I2C humidity module
- 10_log lookup table gives log function of byte -> byte x 100, so log[10] = 
100 and log[100] = 200, used to calculate dew point from temperature and 
relative humidity


-- ------------------------------------------------------
-- Title: PMS3003 dust sensor with 18F67K22
--
-- Author: Eur van Andel, Copyright (c) 2017, all rights reserved.
--
-- Adapted-by:
--
-- Revision: $Revision$
--
-- Compiler: 2.4q5
--
-- This file is part of jallib (https://github.com/jallib/jallib)
-- Released under the ZLIB license  
(http://www.opensource.org/licenses/zlib-license.html)
--
-- Description:
-- Sample program to test the pms3003 dust sensor with a 18f67k22
-- The pms3003 is connected to UART2, outputsi sent to UART21, both at 9600 
baud, N81
--
-- Sources:
--
-- Notes:
-- PIC18F67K22 with 20 MHz external oscillator, pins listed that are used in 
this program
-- nr pin             function       signal
--  4 RG1/TX2/CK2     input          PMS3003_RX
--  7 !MCLR             reset         /MCLR
--  9 VSS               Pwr            GND
-- 25 VSS               Pwr            GND
-- 26 VDD               Pwr            +5V
-- 31 RC6/TX1/CK1      output         PIC_TX
-- 37 RB7/KBI2/PGD   ICSP           PGD
-- 38 VDD               Pwr            +5V
-- 39 OSC1/CLKI         In             OSC1 20 MHz ceramic oscillator
-- 40 OSC2/CLKO         Out         OSC2
-- 41 VSS               Pwr            GND
-- 42 RB6/KBI2/PGC   ICSP           PGC
-- 56 VSS               Pwr            GND
-- 57 VDD               Pwr            +5V
--

include 18f67k22
-- external 20 MHz oscillator on pins OSC1 and OSC2
pragma target clock 20_000_000     -- oscillator frequency

-- configuration memory settings (fuses)
pragma target OSC       HSM   -- external oscillator
pragma target WDT       disabled    -- no watchdog
pragma target XINST     disabled    -- not supported by JalV2
pragma target DEBUG     disabled    -- no debugging
pragma target MCLR      external    -- reset externally

enable_digital_io()

-- SERIAL DATA OUT, UART1 to FTDI cable
-- ---------------------------------------------------------
pin_c6_direction =  output
pin_c7_direction = input

const usart_hw_serial       = true  -- true = RS232, false = SPI
const serial_hw_baudrate    = 9600 -- baud rate
include serial_hardware
serial_hw_init()                 -- calculate baudrate, turn peripheral on

-- SERIAL DATA IN, PMS3003 to UART2, note: 5V to 3V3 level shifters might be 
needed!
-- -----------------------------------------------
pin_g1_direction = output
pin_g2_direction = input

const bit usart_hw2_serial = true  -- true = RS232, false = SPI
const serial_hw2_baudrate    = 9600 -- baud rate
include serial_hardware2
serial_hw2_init()                 -- calculate baudrate, turn peripheral on

include chipdef_jallib

include delay              -- delays: 1us(x), 100us(x), 1ms(x), 100ms(x), 1s(x)
include print              -- print to serial port and LCD
include pms3003    -- Plantower dust sensor

const byte TAB   = 9 -- ASCII_HT too confusing

const byte str_name[] = "18f67k22 pms3003 "
print_crlf(serial_hw_data)
print_string(serial_hw_data, str_name)
print_crlf(serial_hw_data)

forever loop

   if pms3003_receive_msg() then -- keep polling loop tight:
      if pms3003_decode_msg(serial_hw_data) then -- poll often, with no delays
         pms3003_print_data(serial_hw_data)
      end if
   end if

end loop


-- ------------------------------------------------
-- Title: pms3003.jal Library for PMS3003 laser dust sensor
--
-- Author: Eur van Andel, Copyright (c) 2017, all rights reserved.
--
-- Adapted-by: N/A (generated file, do not change!)
--
-- Revision: $Revision$
--
-- Compiler: 2.4q3
--
-- This file is part of jallib (https://github.com/jallib/jallib)
-- Released under the ZLIB license  
(http://www.opensource.org/licenses/zlib-license.html)
--
-- Description:
-- This is the library for the Plantower PMS3003 dust sensor
-- It reads 24 bytes of a 9600 baud N81 serial stream from the sensor. Nothing 
is sent to the sensor,
-- procedures to put the sensor in passive mode or put it to sleep are not 
implemented.
-- There is considerable confusion about the data format. Code and datasheets 
contradict and don't fit the data
-- that comes form the sensor. As far as I can see, the protocol is this:
-- Message example in hex notation:
--  42 4D 00 14 00 0F 00 12 00 13 00 0F 00 12 00 13 03 47 00 06 91 00 01 EC
-- Explanation:
--  42 4D start of message, always the same
--        00 14: frame length of 20, the amount of bytes remaining
--              00 0F: PM1.0 in ug/^3, "standard particle"
--                    00 12: PM2.5 in ug/^3, "standard particle"
--                          00 13: PM10 in ug/^3, "standard particle"
--                                00 0F: PM1.0 in ug/^3, "atmospheric 
environment"
--                                      00 12: PM2.5 in ug/^3, "atmospheric 
environment"
--                                            00 13: PM10 in ug/^3, 
"atmospheric environment"
--                                                  03 47: unknown, changes in 
time
--                                                     00 06: unknown, changes 
in time
--                                                     91 00: always 9100, 
version?
--                                                     01 EC checksum, over all 
bytes
-- .
-- The difference between "standard particle" and "atmospheric environment" is 
unclear. In low concentrations,
-- these numbers are the same. The checksum is a word (two bytes) of all 
*bytes* added, including the 42 4D
-- preamble.
-- Sensor pinout, pin 1 is the furthest from the fan:
-- pin number signal explanation
-- 1 +5V supply: the sensor is 3V3 but the fan is 5V
-- 2 GND
-- 3 SET pull up to 3V3 to keep sensor from sleeping
-- 4 RX 3V3 level receive at 9600 baud, not used here
—  5 TX 3V3 level transmit at 9600 baud
-- 6 RESET pull up to 3V3, pull down to reset sensor
-- 7 NC
-- 8 NC
--
-- Sources:
-- 
https://raw.githubusercontent.com/avaldebe/AQmon/master/Documents/PMS3003_LOGOELE.pdf
-- 
http://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms1003-manual_v2-5.pdf
-- Beware! Not all datasheets list the protocol above.
-- http://www.plantower.com/list/?6_1.html overview of sensors.
--
-- Notes:
-- - In this library, the PMS3003 is hardwired to UART2, set this up in your 
main program.
-- - Output is sent to a "device" which can be another serial port or can be 
discarded
-- - Dust concentration data is stored in 6 PMxx_yy 16-bit variables
-- - File creation date/time: Thu June 22, 2017
-- - This file is maintaned by hand.
-- - Example of UART2 setup:
-- 
------------------------------------------------------------------------------------
-- pin_g1_direction = output     -- check your PIC datasheet for proper pins!
-- pin_g2_direction = input
-- const bit usart_hw2_serial = true   -- true = RS232, false = SPI
-- const serial_hw2_baudrate  = 9600 -- baud rate
-- include serial_hardware2
-- serial_hw2_init()                 -- calculate baudrate, turn peripheral on
-- 
------------------------------------------------------------------------------------
--

var byte msg[30] -- message from dust sensor
var byte old_char

var word pm1_st, pm2_5_st, pm10_st -- "standard particle"      measurements in 
ug/m^3
var word pm1_ae, pm2_5_ae, pm10_ae -- "atmospheric environment" measurements in 
ug/m^3


-- poll often, to sync with start of message
function pms3003_receive_msg() return bit is
   var byte char, index
   if serial_hw2_read(char) then
      if char == 0x4D & old_char == 0x42 then -- "B" & "M"
         index = 3
         msg[1] = old_char
         msg[2] = char
         for 27  loop
            msg[index] = serial_hw2_data
            index = index + 1
         end loop
         return true -- msg received
      else
         old_char = char
         return false
      end if
   else
      return false
   end if
end function


-- message starts at msg[1], more is printed to see where it ends
-- use for debugging only, don't use this in poll loop
procedure _pms3003_print_message(volatile byte out device) is
   var byte i
   print_crlf(device)
   for 30 using i loop
      print_byte_hex(device, msg[i])
      device = " "
   end loop
   print_crlf(device)
end procedure


const byte str_chk_ok[] = " checksum is OK"
const byte str_chk_calc[] = " calculated checksum = "
const byte str_chk_rcvd[] = " received checksum = "
-- reports on checksum validity, redirect to byte var if output is not desired
function pms3003_decode_msg(volatile byte out device) return bit is
   var byte i
   var word checksum = 0
   var word checksum_rcvd

   pm1_st = (word(msg[5]) << 8)  + word(msg[6])
   pm2_5_st = (word(msg[7]) << 8)  + word(msg[8])
   pm10_st = (word(msg[9]) << 8)  + word(msg[10])
   pm1_ae = (word(msg[11]) << 8) + word(msg[12])
   pm2_5_ae = (word(msg[13]) << 8) + word(msg[14])
   pm10_ae = (word(msg[15]) << 8) + word(msg[16])

   checksum_rcvd = (word(msg[23]) << 8) + word(msg[24])

   for  22 using i loop
      checksum = checksum + word(msg[i+1])
   end loop

   if checksum_rcvd == checksum then
      print_string(device, str_chk_ok)
      print_crlf(device)
      return true
   else
      print_string(device, str_chk_rcvd)
      print_word_hex(device, checksum_rcvd)
      device = "," device = " "
      print_string(device, str_chk_calc)
      print_word_hex(device, checksum)
      print_crlf(device)
      return false
   end if
end function



const byte str_pm1_st[]    = "PM1_st = "
const byte str_pm2_5_st[]  = "PM2_5_st = "
const byte str_pm10_st[]   = "PM10_st = "

const byte str_pm1_ae[]    = "PM1_ae = "
const byte str_pm2_5_ae[]  = "PM2_5_ae = "
const byte str_pm10_ae[]   = "PM10_ae = "

const byte str_ug_m3[]    = " ug/m^3"

procedure pms3003_print_data(volatile byte out device) is
   print_string(device, str_pm1_st)
   print_word_dec(device, pm1_st)
   print_string(device, str_ug_m3)
   device = "," device = " "

   print_string(device, str_pm2_5_st)
   print_word_dec(device, pm2_5_st)
   print_string(device, str_ug_m3)
   device = "," device = " "

   print_string(device, str_pm10_st)
   print_word_dec(device, pm10_st)
   print_string(device, str_ug_m3)
   print_crlf(device)

   print_string(device, str_pm1_ae)
   print_word_dec(device, pm1_ae)
   print_string(device, str_ug_m3)
   device = "," device = " "

   print_string(device, str_pm2_5_ae)
   print_word_dec(device, pm2_5_ae)
   print_string(device, str_ug_m3)
   device = "," device = " "

   print_string(device, str_pm10_ae)
   print_word_dec(device, pm10_ae)
   print_string(device, str_ug_m3)
   print_crlf(device)

end procedure


---
ir EE van Andel [email protected]<mailto:[email protected]>  
http://www.fiwihex.nl<http://www.fiwihex.nl/>
Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands
tel +31-653-286573





--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to