Skip to content

Commit 72b69d6

Browse files
committed
Add code base
1 parent 8eb0b66 commit 72b69d6

26 files changed

+4757
-0
lines changed

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/Fan.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Fan1Tests.csv

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
TCID,Min,Max,Descript,Type,Prop,Meas,Result
2+
BL601_0,0,0,Fan Serial Number,Info,SerN,,,
3+
BL601_1,1,1,Set address to 11,Test,Bool,,
4+
BL601_2,1,1,Apply new configurations,Test,Bool,,
5+
BL601_3,1,1,Set to 485 control,Test,Bool,,
6+
BL601_4,1,1,Set speed control to closed loop,Test,Bool,,
7+
BL601_5,1,1,Apply new configurations,Test,Bool,,
8+
BL601_6,1,1,Confirm speed control set to closed loop,Test,Bool,,

Fan2Tests.csv

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
TCID,Min,Max,Descript,Type,Prop,Meas,Result
2+
BL602_0,0,0,Fan Serial Number,Info,SerN,,,
3+
BL602_1,1,1,Set address to 12,Test,Bool,,
4+
BL602_2,1,1,Apply new configurations,Test,Bool,,
5+
BL602_3,1,1,Set to 485 control,Test,Bool,,
6+
BL602_4,1,1,Set speed control to closed loop,Test,Bool,,
7+
BL602_5,1,1,Apply new configurations,Test,Bool,,
8+
BL602_6,1,1,Confirm speed control set to closed loop,Test,Bool,,

Fan3Tests.csv

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
TCID,Min,Max,Descript,Type,Prop,Meas,Result
2+
BL603_0,0,0,Fan Serial Number,Info,SerN,,,
3+
BL603_1,1,1,Set address to 13,Test,Bool,,
4+
BL603_2,1,1,Apply new configurations,Test,Bool,,
5+
BL603_3,1,1,Set to 485 control,Test,Bool,,
6+
BL603_4,1,1,Set speed control to closed loop,Test,Bool,,
7+
BL603_5,1,1,Apply new configurations,Test,Bool,,
8+
BL603_6,1,1,Confirm speed control set to closed loop,Test,Bool,,

SConstruct

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
################################################################################
2+
# Copyright (c) 2017 Schneider Electric Solar Inverters USA, Inc.
3+
#
4+
# No part of this document may be reproduced in any form or disclosed to third
5+
# parties without the express written consent of:
6+
# Schneider Electric Solar Inverters USA, Inc.
7+
#
8+
# FILE NAME:
9+
# SConstruct
10+
#
11+
# PURPOSE:
12+
# Used to build the program to program the SE1 fans.
13+
#
14+
#
15+
#
16+
# NOTES:
17+
#
18+
# CHANGE HISTORY:
19+
# $Log: SConstruct $
20+
#
21+
################################################################################
22+
23+
###############################################################################
24+
# Included Modules #
25+
###############################################################################
26+
import os
27+
import sys
28+
import subprocess
29+
import re
30+
import fileinput
31+
#monitor_stdout = sys.stdout
32+
################################################################################
33+
# Defines #
34+
################################################################################
35+
GUISOURCEFILE = 'SE1FanProgrammer.pyw'
36+
SOURCEFILES = Glob('*.py')
37+
SOURCEFILES += Glob('*.pyw')
38+
#PyInstaller Spec File
39+
SPECFILE = 'SE1FanProgrammer.spec'
40+
41+
#Version Reg-ex Patterns
42+
SRC_PATTERN = re.compile('(^__version__\s=\s")([x\d].[x\d].[x\d]+)(")')
43+
VER_PATTERN = re.compile('([x\d].[x\d].[x\d]+)')
44+
45+
# Inno installer stuff...
46+
ISSFILE = 'SE1FanProgrammer.iss'
47+
ISS_PATTERN = re.compile(r'(AppVerName=SE1 Fan Programmer V)')
48+
49+
INNO_LOCATION = None
50+
INNO_TEST_LOCATION_1 = r'C:\Program Files\Inno Setup 5\ISCC.exe'
51+
INNO_TEST_LOCATION_2 = r'C:\Program Files (x86)\Inno Setup 5\ISCC.exe'
52+
53+
if os.path.exists(INNO_TEST_LOCATION_1):
54+
INNO_LOCATION = '\"' + INNO_TEST_LOCATION_1 + '\" {}'
55+
elif os.path.exists(INNO_TEST_LOCATION_2):
56+
INNO_LOCATION = '\"' + INNO_TEST_LOCATION_2 + '\" {}'
57+
elif not INNO_LOCATION:
58+
raise Exception, "Inno Setup was not found on system"
59+
60+
################################################################################
61+
# General Purpose Function Definitions #
62+
################################################################################
63+
64+
def fnVersionFormatValid(versionstring):
65+
if VER_PATTERN.match(versionstring):
66+
return
67+
else:
68+
raise Exception, 'Not correct version format'
69+
70+
def fnReplaceVersionInLine(file, repattern, version):
71+
72+
boolFoundAReplacment = False
73+
74+
for line in fileinput.input(file, inplace=1):
75+
matchstring = repattern.match(line)
76+
if matchstring:
77+
line = VER_PATTERN.sub( version , line )
78+
boolFoundAReplacment = True
79+
#monitor_stdout.write(version)
80+
#monitor_stdout.write(line)
81+
sys.stdout.write(line)
82+
fileinput.close()
83+
84+
assert boolFoundAReplacment, "Pattern to replace not found"
85+
86+
################################################################################
87+
# Script Start #
88+
################################################################################
89+
vars = Variables()
90+
vars.Add('SWVERSION', 'Sets the version in the form of x.x.x', 'x.x.x')
91+
92+
#Create environment
93+
env = Environment(variables = vars)
94+
Help(vars.GenerateHelpText(env))
95+
96+
print 'Building Software Version:' + env['SWVERSION']
97+
fnVersionFormatValid(env['SWVERSION'])
98+
99+
#Change the version in the source files
100+
fnReplaceVersionInLine( ISSFILE, ISS_PATTERN, env['SWVERSION'] )
101+
fnReplaceVersionInLine( GUISOURCEFILE, SRC_PATTERN, env['SWVERSION'])
102+
103+
#Building the program
104+
gui_depends = (SOURCEFILES, GUISOURCEFILE , ISSFILE, SPECFILE)
105+
gui_targets = ('dist/bms_simulator/BMS_Simulator.exe')
106+
gui_clean_files = [r'./dist', r'./build', r'./~', r'*.pyc']
107+
gui_command = env.Command( gui_targets, gui_depends, 'C:\Python27\Scripts\pyinstaller.exe --noconfirm {}'.format(SPECFILE) )
108+
env.Clean(gui_command , gui_clean_files)
109+
110+
#Building the Installer
111+
installer_depends = ('.\dist', ISSFILE)
112+
installer_targets = ('Output\SE1FanProg_V.exe')
113+
installer_command = env.Command( installer_targets , installer_depends , INNO_LOCATION.format(ISSFILE))
114+
installer_clean_files = Glob(r'.\Output')
115+
env.Clean(installer_command , installer_clean_files)
116+
117+
#Copy the file and rename
118+
rename_depends = ('Output\SE1FanProg_V.exe')
119+
rename_targets = 'SE1FanProg_V' + env['SWVERSION'] + '.exe'
120+
rename_clean_files = Glob('SE1FanProg_V*.exe')
121+
rename_command = env.Command( rename_targets , rename_depends , Copy("$TARGET", "$SOURCE") )
122+
env.Clean(rename_command , rename_clean_files)
123+

SE1FanProgrammer.iss

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
; Script generated by the Inno Setup Script Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+
[Setup]
5+
; NOTE: The value of AppId uniquely identifies this application.
6+
; Do not use the same AppId value in installers for other applications.
7+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
8+
AppId={{2AF2147C-ABF5-43DE-B88A-C028062FF172}
9+
AppName=SE1 Fan Programmer
10+
AppVerName=SE1 Fan Programmer Vx.x.x
11+
AppPublisher=Schneider Electric
12+
AppPublisherURL=http://www.schneider-electric.com
13+
AppSupportURL=http://www.schneider-electric.com
14+
AppUpdatesURL=http://www.schneider-electric.com
15+
DefaultDirName=C:\SE1FanProgrammer
16+
DisableDirPage=yes
17+
DisableProgramGroupPage=yes
18+
OutputBaseFilename=SE1FanProg_V
19+
SetupIconFile=.\images\fan.ico
20+
Compression=lzma
21+
SolidCompression=yes
22+
;We need this because we added to the path...
23+
ChangesEnvironment=yes
24+
UninstallDisplayIcon={app}\SE1FanProgrammer.exe
25+
26+
[Languages]
27+
Name: "english"; MessagesFile: "compiler:Default.isl"
28+
29+
[Tasks]
30+
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags:
31+
32+
[Files]
33+
Source: ".\dist\SE1FanProgrammer\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
34+
35+
[Dirs]
36+
Name: "{app}\DebugLogs"
37+
Name: "{app}\TestResults"
38+
39+
[Icons]
40+
Name: "{commondesktop}\DebugLogs"; Filename: "{app}\DebugLogs"
41+
Name: "{commondesktop}\TestResults"; Filename: "{app}\TestResults"
42+
43+
[Icons]
44+
Name: "{userdesktop}\SE1FanProgrammer"; Filename: "{app}\SE1FanProgrammer.exe"; Tasks: desktopicon; WorkingDir: {app}
45+
46+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

0 commit comments

Comments
 (0)