Module SharedConstants
[frames] | no frames]

Source Code for Module SharedConstants

 1  # SharedConstants.py 
 2   
 3  ''' 
 4   This software is part of the EV3BrickPi module. 
 5   It is Open Source Free Software, so you may 
 6   - run the code for any purpose 
 7   - study how the code works and adapt it to your needs 
 8   - integrate all or parts of the code in your own programs 
 9   - redistribute copies of the code 
10   - improve the code and release your improvements to the public 
11   However the use of the code is entirely your responsibility. 
12  ''' 
13   
14  ''' 
15  History: 
16   
17  V1.00 - July 2017: - Ported from RaspiBrick 
18  ''' 
19   
20  VERSION = "1.00 - July 2017" 
21  DISPLAYED_VERSION = "100"  # displayed n.nn 
22   
23  DEBUG = False 
24   
25  P_BUTTON1 = 18 
26  P_BUTTON2 = 16 
27  P_BUZZER = 40 
28   
29  # Default speed 
30  MOTOR_DEFAULT_SPEED = 40 
31  # BrickPi power range 0..100 (forward), 0..-100 (backward) 
32  # Lego speed range 0..100 
33  MOTOR_POWER_TO_SPEED_FACTOR = 1.0  # power/speed 
34  # Length of axes used in Gear.leftArc(), Gear.rightArc() (arbitrary unit, approx m) 
35  GEAR_AXE_LENGTH = 0.06 
36  # Default speed 
37  GEAR_DEFAULT_SPEED = 40 
38  # Break delay is the time to wait before stopping the gear in blocking methods 
39  GEAR_BREAK_DELAY = 200 
40  # Difference between left and right motor in Gear() due to different mechanics 
41  # diff = leftSpeed - rightSpeed 
42  GEAR_FORWARD_SPEED_DIFF = 0.5 
43  GEAR_BACKWARD_SPEED_DIFF = 0.5 
44   
45  # Config file to store last program name 
46  CONFIG_FILE = "/home/pi/scripts/raspibrick.cfg" 
47  # Path of execution app 
48  APP_PATH = "/home/pi/scripts/MyApp" 
49   
50  # Button event constants 
51  BUTTON_PRESSED = 1 
52  BUTTON_RELEASED = 2 
53  BUTTON_LONGPRESSED = 3 
54  BUTTON_CLICKED = 4 
55  BUTTON_DOUBLECLICKED = 5 
56  BUTTON_LONGPRESS_DURATION = 2 # time (in s) the button must be pressed to be a long press 
57  BUTTON_DOUBLECLICK_TIME = 1 # default time (in s) to wait for a double click event 
58   
59  # Event poll delay (ms) 
60  POLL_DELAY = 50 
61   
62  ABOUT = "2003-2017 Aegidius Pluess\n" + \ 
63           "OpenSource Free Software\n" + \ 
64           "http://www.aplu.ch\n" + \ 
65           "All rights reserved" 
66