Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix several issues. #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ APP_NAME=PICkit3
PROJECT_DIR=PICkit2V2
BUILD_CONFIG=Release
INSTALL_DIR=/opt/microchip/pickit3
USE_MSBUILD := $(shell command -v msbuild 2> /dev/null)

BUILD_DIR=$(PROJECT_DIR)/bin/$(BUILD_CONFIG)


build:
nuget restore -NonInteractive

ifdef USE_MSBUILD
msbuild -t:Build -p:Configuration="$(BUILD_CONFIG)" -v:quiet
else
xbuild /target:Build /property:Configuration="$(BUILD_CONFIG)" /verbosity:quiet
endif

install: install-bundle install-bin install-link install-udev-rules

Expand Down
4 changes: 2 additions & 2 deletions PICkit2V2/DialogLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private Bitmap getDisplayGraph(int zoom)
else if (zoom == 3)
length = 4096;

Bitmap gridmap = new Bitmap(length, width, PixelFormat.Format16bppRgb555);
Bitmap gridmap = new Bitmap(length, width);
Graphics graphics = Graphics.FromImage(gridmap);
SolidBrush brush = new SolidBrush(Color.Black);
graphics.FillRectangle(brush, 0, 0, length, width);
Expand Down Expand Up @@ -1480,4 +1480,4 @@ private void checkBoxVDD_Click(object sender, EventArgs e)
}

}
}
}
2 changes: 1 addition & 1 deletion PICkit2V2/FormPICkit2.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 39 additions & 14 deletions PICkit2V2/FormPICkit2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices; // DllImport
using System.Reflection;
using Pk2 = PICkit2V2.PICkitFunctions;
using P32 = PICkit2V2.PIC32MXFunctions;
using PE33 = PICkit2V2.dsPIC33_PE;
Expand Down Expand Up @@ -438,6 +439,8 @@ public struct FLASHWINFO
public static float ScalefactW = 1F; // scaling factors for dealing with non-standard DPI
public static float ScalefactH = 1F;
public static string HomeDirectory;
public static string DocDirectory;
public static string UserConfigDirectory;
public static byte slowSpeedICSP = 4; // default value
public static bool PlaySuccessWav = false;
public static string SuccessWavFile = "\\Sounds\\success.wav";
Expand Down Expand Up @@ -5629,7 +5632,7 @@ private void launchUsersGuide(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, KONST.UserGuideFileNamePK2));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, KONST.UserGuideFileNamePK2));
}
catch
{
Expand All @@ -5641,7 +5644,7 @@ private void launchReadMe(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "PICkit 2 Readme.txt"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "PICkit 2 Readme.txt"));
}
catch
{
Expand All @@ -5653,7 +5656,7 @@ private void betaReleaseReadMeToolStripMenuItem_Click(object sender, EventArgs e
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "PICkit 3 Programmer Application ReadMe.txt"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "PICkit 3 Programmer Application ReadMe.txt"));
}
catch
{
Expand Down Expand Up @@ -5950,15 +5953,21 @@ private void autoDownloadFW(object sender, EventArgs e)
private void SaveINI()
{
//StreamWriter hexFile = new StreamWriter("PICkit2.ini");

string iniFile;
StreamWriter hexFile;

if (!Pk2.isPK3)
hexFile = File.CreateText(Path.Combine(HomeDirectory, "PICkit2.ini"));
iniFile = "PICkit2.ini";
else
hexFile = File.CreateText(Path.Combine(HomeDirectory, "PICkit3.ini"));
iniFile = "PICkit3.ini";

hexFile = File.CreateText(Path.Combine(UserConfigDirectory, iniFile));

// Comments
string value = ";" + Pk2.ToolName + " version " + Constants.AppVersion + " INI file.";
// Comments
string value = ";" + Pk2.ToolName + " version " + Constants.AppVersion + " INI file.";
hexFile.WriteLine(value);

DateTime now = new DateTime();
now = System.DateTime.Now;
value = ";" + now.Date.ToShortDateString() + " " + now.ToShortTimeString();
Expand Down Expand Up @@ -6369,14 +6378,30 @@ private float loadINI()
int desktopHeigth = SystemInformation.VirtualScreen.Height;
int desktopWidth = SystemInformation.VirtualScreen.Width;

string iniFile;
FileInfo hexFile;

if (!Pk2.isPK3)
hexFile = new FileInfo("PICkit2.ini");
iniFile = "PICkit2.ini";
else
hexFile = new FileInfo("PICkit3.ini");
iniFile = "PICkit3.ini";

hexFile = new FileInfo(iniFile);
HomeDirectory = hexFile.DirectoryName;
hexFile = null;

DocDirectory = Path.Combine(HomeDirectory, "docs");

UserConfigDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
this.GetType().Assembly.GetName().Name);

if (!Directory.Exists(UserConfigDirectory)) {
Directory.CreateDirectory(UserConfigDirectory);
}

hexFile = new FileInfo(Path.Combine(UserConfigDirectory, iniFile));

// init default sounds locations
SuccessWavFile = Path.Combine(HomeDirectory, SuccessWavFile);
WarningWavFile = Path.Combine(HomeDirectory, WarningWavFile);
Expand Down Expand Up @@ -8104,7 +8129,7 @@ public void OpenProgToGoUserGuide()
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Programmer-To-Go User Guide.pdf"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Programmer-To-Go User Guide.pdf"));
}
catch
{
Expand Down Expand Up @@ -8189,7 +8214,7 @@ private void toolStripMenuItemLogicToolUG_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Logic Tool User Guide.pdf"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Logic Tool User Guide.pdf"));
}
catch
{
Expand Down Expand Up @@ -8613,7 +8638,7 @@ private void launchUsersGuidePK3(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, KONST.UserGuideFileNamePK3));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, KONST.UserGuideFileNamePK3));
}
catch
{
Expand All @@ -8637,7 +8662,7 @@ private void uG44pinToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "44-Pin Demo Board User Guide 41296B.pdf"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "44-Pin Demo Board User Guide 41296B.pdf"));
}
catch
{
Expand All @@ -8649,7 +8674,7 @@ private void lpcUsersGuideToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.Combine(HomeDirectory, "Low Pin Count User Guide 51556a.pdf"));
System.Diagnostics.Process.Start(Path.Combine(DocDirectory, "Low Pin Count User Guide 51556a.pdf"));
}
catch
{
Expand Down
4 changes: 2 additions & 2 deletions PICkit2V2/PICkit3V3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="HidSharp">
<HintPath>..\packages\HidSharp.2.0.5\lib\net35\HidSharp.dll</HintPath>
<HintPath>..\packages\HidSharp.2.1.0\lib\net35\HidSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -352,4 +352,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
4 changes: 2 additions & 2 deletions PICkit2V2/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HidSharp" version="2.0.5" targetFramework="net40" />
</packages>
<package id="HidSharp" version="2.1.0" targetFramework="net40" />
</packages>
2 changes: 1 addition & 1 deletion bundle/bin/pickit3
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e

cd $(dirname $(realpath $0))/..
exec bin/PICkit3.exe
exec mono bin/PICkit3.exe "$@"