[chronojump] DB: 1.49: Force sensor adjust info saved on SQL
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] DB: 1.49: Force sensor adjust info saved on SQL
- Date: Mon, 30 Oct 2017 11:44:27 +0000 (UTC)
commit 867fbd626978f218731b5ebd645e0201a905e182
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Oct 30 12:43:23 2017 +0100
DB: 1.49: Force sensor adjust info saved on SQL
glade/app1.glade | 97 +++++++++++++++++++++++++++++++++++--------
glade/preferences_win.glade | 4 +-
src/forceSensor.cs | 2 -
src/gui/chronojump.cs | 5 +-
src/gui/chronojumpIcons.cs | 2 +
src/gui/forceSensor.cs | 54 ++++++++++++++++++++++++
src/gui/preferences.cs | 2 +
src/preferences.cs | 52 +++++++++++++++++++++++
src/sqlite/main.cs | 16 +++++++-
src/sqlite/preferences.cs | 31 +++++++++++++-
src/util.cs | 1 +
src/utilDate.cs | 1 +
12 files changed, 240 insertions(+), 27 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 04057e3..45cf60e 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1414,6 +1414,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -4611,7 +4614,7 @@ EncoderInertialCapture</property>
<widget class="GtkHBox" id="hbox_force_buttons">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">30</property>
+ <property name="spacing">40</property>
<child>
<widget class="GtkButton"
id="button_force_sensor_load">
<property name="label" translatable="yes">Load
file</property>
@@ -4621,12 +4624,34 @@ EncoderInertialCapture</property>
<signal name="clicked"
handler="on_button_force_sensor_load_clicked" swapped="no"/>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox152">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkLabel" id="label111">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Adjust:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
+ <widget class="GtkHBox" id="hbox207">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
<widget class="GtkButton"
id="button_force_sensor_tare">
<property name="label"
translatable="yes">Tare</property>
<property name="visible">True</property>
@@ -4635,16 +4660,16 @@ EncoderInertialCapture</property>
<signal name="clicked"
handler="on_buttons_force_sensor_clicked" swapped="no"/>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox230">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkHBox"
id="hbox_spin_force_sensor">
<property name="visible">True</property>
@@ -4709,35 +4734,55 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_force_sensor_data_folder">
- <property name="label" translatable="yes">Open
data folder</property>
+ <widget class="GtkButton"
id="button_force_sensor_adjust_help">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_force_sensor_data_folder_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_button_force_sensor_adjust_help_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage"
id="image_force_sensor_adjust_help">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_force_sensor_check_version">
- <property name="label" translatable="yes">Check
version</property>
+ <widget class="GtkButton"
id="button_force_sensor_data_folder">
+ <property name="label" translatable="yes">Open
data folder</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked"
handler="on_buttons_force_sensor_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_button_force_sensor_data_folder_clicked" swapped="no"/>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -5057,7 +5102,7 @@ EncoderInertialCapture</property>
<property name="can_focus">False</property>
<property name="top_padding">8</property>
<child>
- <widget class="GtkHBox"
id="hbox_chronopics_and_threshold">
+ <widget class="GtkHBox"
id="hbox_chronopics_and_more">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
@@ -5136,6 +5181,21 @@ EncoderInertialCapture</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_check_version">
+ <property name="label" translatable="yes">Check
version</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip"
translatable="yes">Check version of force sensor firmware.</property>
+ <signal name="clicked"
handler="on_buttons_force_sensor_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -21711,6 +21771,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 0cc0c60..dfeafcd 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -1771,10 +1771,10 @@ It starts before and arrives there with some speed.</property>
<property name="has_tooltip">True</property>
<signal name="clicked" handler="on_button_inactivity_help_clicked"
swapped="no"/>
<child>
- <widget class="GtkImage" id="image31">
+ <widget class="GtkImage" id="image_encoder_inactivity_help">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-dialog-info</property>
+ <property name="stock">gtk-missing-image</property>
<property name="icon-size">2</property>
</widget>
</child>
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 90da9bd..db13bb9 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -104,8 +104,6 @@ public class ForceSensorCapturePoints
// this is called at load signal, checks if last X is outside the graph and max/min force
public bool OutsideGraph(int lastTime, double minForce, double maxForce)
{
- Gdk.Point p = getLastPoint();
-
RealWidthG = lastTime + GetTimeInPx(marginLeft) + GetTimeInPx(marginRight);
double absoluteMaxForce = maxForce;
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index c974255..cc28ff0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -324,6 +324,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_upload_session;
[Widget] Gtk.Button button_activate_chronopics;
+ [Widget] Gtk.Button button_threshold;
//non standard icons
[Widget] Gtk.Image image_jump_reactive_bell;
@@ -6348,9 +6349,7 @@ LogB.Debug("X");
//LogB.Information("desiredPage" + desiredPage.ToString());
//on capture, show phases, time, record if we are not on forcesensor mode
- hbox_capture_phases_time_record.Visible = (mode != Constants.Menuitem_modes.FORCESENSOR);
- hbox_options_top.Visible = (mode != Constants.Menuitem_modes.FORCESENSOR);
- notebook_options_top.Visible = (mode != Constants.Menuitem_modes.FORCESENSOR);
+ showHideForceSensorControls(mode == Constants.Menuitem_modes.FORCESENSOR);
if(mode == Constants.Menuitem_modes.JUMPSSIMPLE)
{
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 99abc30..7db846f 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -54,6 +54,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_info2;
[Widget] Gtk.Image image_info3;
[Widget] Gtk.Image image_info4;
+ [Widget] Gtk.Image image_force_sensor_adjust_help;
[Widget] Gtk.Image image_info_sessions_info;
[Widget] Gtk.Image image_add_test1;
[Widget] Gtk.Image image_add_test2;
@@ -187,6 +188,7 @@ public partial class ChronoJumpWindow
image_info4.Pixbuf = pixbuf;
image_info_sessions_info.Pixbuf = pixbuf;
image_encoder_1RM_info.Pixbuf = pixbuf;
+ image_force_sensor_adjust_help.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_add_test.png");
image_add_test1.Pixbuf = pixbuf;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index f97894a..cfa0ca6 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -41,6 +41,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Viewport viewport_force_sensor_graph;
[Widget] Gtk.Image image_force_sensor_graph;
[Widget] Gtk.SpinButton spin_force_sensor_calibration_kg_value;
+ [Widget] Gtk.Button button_force_sensor_check_version;
[Widget] Gtk.Button button_force_sensor_image_save_signal;
[Widget] Gtk.Button button_force_sensor_image_save_rfd;
[Widget] Gtk.DrawingArea force_capture_drawingarea;
@@ -265,13 +266,16 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorTare()
{
+ // 0 connect if needed
if(! portFSOpened)
if(! forceSensorConnect())
return;
+ // 1 send tare command
if(! forceSensorSendCommand("tare:", "Taring ...", "Catched force taring"))
return;
+ // 2 read confirmation data
string str = "";
do {
Thread.Sleep(100); //sleep to let arduino start reading
@@ -285,6 +289,19 @@ public partial class ChronoJumpWindow
}
while(! str.Contains("Taring OK"));
+ // 3 get tare factor
+ if (portFS.BytesToRead > 0)
+ LogB.Information("PRE_get_tare bytes: " + portFS.ReadExisting());
+
+ if(! forceSensorSendCommand("get_tare:", "Checking ...", "Catched at get_tare"))
+ return;
+
+ // 4 update preferences and SQL with new tare
+ str = Util.ChangeDecimalSeparator(portFS.ReadLine().Trim());
+ if(Util.IsNumber(str, true))
+ preferences.UpdateForceSensorTare(Convert.ToDouble(str));
+
+ // 5 print message
forceSensorOtherMessageShowSeconds = false;
forceSensorOtherMessage = "Tared!";
}
@@ -292,14 +309,17 @@ public partial class ChronoJumpWindow
//Attention: no GTK here!!
private void forceSensorCalibrate()
{
+ // 0 connect if needed
if(! portFSOpened)
if(! forceSensorConnect())
return;
+ // 1 send calibrate command
if(! forceSensorSendCommand("calibrate:" +
spin_force_sensor_calibration_kg_value.Value.ToString() + ";",
"Calibrating ...", "Catched force calibrating"))
return;
+ // 2 read confirmation data
string str = "";
do {
Thread.Sleep(100); //sleep to let arduino start reading
@@ -313,6 +333,20 @@ public partial class ChronoJumpWindow
}
while(! str.Contains("Calibrating OK"));
+ // 3 get calibration factor
+ if (portFS.BytesToRead > 0)
+ LogB.Information("PRE_get_calibrationfactor bytes: " + portFS.ReadExisting());
+
+ if(! forceSensorSendCommand("get_calibration_factor:", "Checking ...", "Catched at
get_calibration_factor"))
+ return;
+
+ // 4 update preferences and SQL with new calibration factor
+ str = Util.ChangeDecimalSeparator(portFS.ReadLine().Trim());
+ if(Util.IsNumber(str, true))
+ preferences.UpdateForceSensorCalibration(
+ spin_force_sensor_calibration_kg_value.Value, Convert.ToDouble(str));
+
+ // 5 print message
forceSensorOtherMessageShowSeconds = false;
forceSensorOtherMessage = "Calibrated!";
}
@@ -797,6 +831,12 @@ LogB.Information(" fc R ");
string [] strFull = str.Split(new char[] {';'});
if(strFull.Length != 2)
continue;
+
+ /*
+ * TODO: Make this work with decimals as comma and decimals as point
+ * to fix problems on importing data on different localised computer
+ */
+
if(Util.IsNumber(strFull[0], false) && Util.IsNumber(strFull[1], true))
{
double force = Convert.ToDouble(strFull[1]);
@@ -960,6 +1000,20 @@ LogB.Information(" fc R ");
new DialogMessage(Constants.MessageTypes.WARNING, Constants.DirectoryCannotOpen);
}
+ private void showHideForceSensorControls(bool modeForceSensor)
+ {
+ hbox_capture_phases_time_record.Visible = ! modeForceSensor;
+ hbox_options_top.Visible = ! modeForceSensor;
+ notebook_options_top.Visible = ! modeForceSensor;
+
+ button_threshold.Visible = ! modeForceSensor;
+ button_force_sensor_check_version.Visible = modeForceSensor;
+ }
+
+ private void on_button_force_sensor_adjust_help_clicked (object o, EventArgs args)
+ {
+ new DialogMessage("Force sensor adjust data", Constants.MessageTypes.INFO,
preferences.GetForceSensorAdjustString());
+ }
double lastChangedTime; //changeSlideCode
private void changeSlideIfNeeded(int time, double force)
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 1935be4..4c975f4 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -122,6 +122,7 @@ public class PreferencesWindow
[Widget] Gtk.SpinButton spin_encoder_capture_barplot_font_size;
[Widget] Gtk.CheckButton check_show_start_and_duration;
[Widget] Gtk.CheckButton check_encoder_capture_cut_by_triggers;
+ [Widget] Gtk.Image image_encoder_inactivity_help;
[Widget] Gtk.Image image_encoder_capture_cut_by_triggers_help;
//encoder other tab
@@ -407,6 +408,7 @@ public class PreferencesWindow
PreferencesWindowBox.image_races_intervallic.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_info.png");
+ PreferencesWindowBox.image_encoder_inactivity_help.Pixbuf = pixbuf;
PreferencesWindowBox.image_encoder_capture_cut_by_triggers_help.Pixbuf = pixbuf;
if(menu_mode == Constants.Menuitem_modes.RUNSSIMPLE)
diff --git a/src/preferences.cs b/src/preferences.cs
index 2c0cb51..2497766 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -94,6 +94,12 @@ public class Preferences
public string machineID;
public Constants.MultimediaStorage multimediaStorage;
public string databaseVersion;
+
+ public string forceSensorTareDateTime;
+ public double forceSensorTare;
+ public string forceSensorCalibrationDateTime;
+ public double forceSensorCalibrationWeight;
+ public double forceSensorCalibrationFactor;
public int encoderCaptureTimeIM = 120; //hardcoded 2 minutes.
@@ -147,6 +153,52 @@ public class Preferences
return changed;
}
+ //force sensor
+ public void UpdateForceSensorTare(double tare)
+ {
+ if(tare == -1)
+ return;
+
+ //change preferences object and SqlitePreferences
+ DateTime dt = DateTime.Now;
+
+ forceSensorTareDateTime = UtilDate.ToFile(dt);
+ SqlitePreferences.Update(SqlitePreferences.ForceSensorTareDateTimeStr,
forceSensorTareDateTime, false);
+
+ forceSensorTare = tare;
+ SqlitePreferences.Update(SqlitePreferences.ForceSensorTareStr, Util.ConvertToPoint(tare),
false);
+ }
+ //force sensor
+ public void UpdateForceSensorCalibration(double weight, double calibrationFactor)
+ {
+ if(calibrationFactor == -1)
+ return;
+
+ //change preferences object and SqlitePreferences
+ DateTime dt = DateTime.Now;
+
+ forceSensorCalibrationDateTime = UtilDate.ToFile(dt);
+ SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationDateTimeStr,
forceSensorCalibrationDateTime, false);
+
+ forceSensorCalibrationWeight = weight;
+ SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationWeightStr,
Util.ConvertToPoint(weight), false);
+
+ forceSensorCalibrationFactor = calibrationFactor;
+ SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationFactorStr,
Util.ConvertToPoint(calibrationFactor), false);
+ }
+
+ public string GetForceSensorAdjustString()
+ {
+ return "\nLast tare:" +
+ "\n\t- internal value: " + forceSensorTare.ToString() +
+ "\n\t- at: " + forceSensorTareDateTime +
+ "\n\nLast Calibrate:" +
+ "\n\t- internal value: " + forceSensorCalibrationFactor.ToString() +
+ "\n\t- with: " + forceSensorCalibrationWeight.ToString() +
+ " Kg\n\t- at: " + forceSensorCalibrationDateTime;
+ }
+
+
~Preferences() {}
}
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 8c50fcb..e9cadbf 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -125,7 +125,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.48";
+ static string lastChronojumpDatabaseVersion = "1.49";
public Sqlite() {
}
@@ -2250,6 +2250,19 @@ class Sqlite
currentVersion = updateVersion("1.48");
}
+ if(currentVersion == "1.48")
+ {
+ LogB.SQL("Updated preferences: added force sensor tare/calibration stuff");
+
+ SqlitePreferences.Insert (SqlitePreferences.ForceSensorTareDateTimeStr, "");
+ SqlitePreferences.Insert (SqlitePreferences.ForceSensorTareStr, "-1");
//result value from sensor
+ SqlitePreferences.Insert
(SqlitePreferences.ForceSensorCalibrationDateTimeStr, "");
+ SqlitePreferences.Insert (SqlitePreferences.ForceSensorCalibrationWeightStr,
"-1");
+ SqlitePreferences.Insert (SqlitePreferences.ForceSensorCalibrationFactorStr,
"-1"); //result value from sensor
+
+ currentVersion = updateVersion("1.49");
+ }
+
// --- add more updates here
@@ -2431,6 +2444,7 @@ class Sqlite
SqlitePreferences.initializeTable(lastChronojumpDatabaseVersion, creatingBlankDatabase);
//changes [from - to - desc]
+ //1.48 - 1.49 Converted DB to 1.49 Updated preferences: added force sensor tare/calibration
stuff
//1.47 - 1.48 Converted DB to 1.48 Updated preferences: added gstreamer
//1.46 - 1.47 Converted DB to 1.47 Added encoderCaptureBarplotFontSize at preferences
//1.45 - 1.46 Converted DB to 1.46 Added muteLogs at preferences
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index c96846e..7b9d7ab 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -36,6 +36,12 @@ class SqlitePreferences : Sqlite
public const string EncoderMassGravitatory = "encoderMassGravitatory";
public const string EncoderWeightsInertial = "encoderWeightsInertial";
+ public const string ForceSensorTareDateTimeStr = "forceSensorTareDateTime";
+ public const string ForceSensorTareStr = "forceSensorTare";
+ public const string ForceSensorCalibrationDateTimeStr = "forceSensorCalibrationDateTime";
+ public const string ForceSensorCalibrationWeightStr = "forceSensorCalibrationWeight";
+ public const string ForceSensorCalibrationFactorStr = "forceSensorCalibrationFactor";
+
protected internal static new void createTable()
{
dbcmd.CommandText =
@@ -146,6 +152,11 @@ class SqlitePreferences : Sqlite
Insert ("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.BEST.ToString(), dbcmdTr);
Insert ("email", "", dbcmdTr);
Insert ("muteLogs", "False", dbcmdTr);
+ Insert (ForceSensorTareDateTimeStr, "", dbcmdTr);
+ Insert (ForceSensorTareStr, "-1", dbcmdTr); //result value from sensor.
Decimal is point!!
+ Insert (ForceSensorCalibrationDateTimeStr, "", dbcmdTr);
+ Insert (ForceSensorCalibrationWeightStr, "-1", dbcmdTr);
+ Insert (ForceSensorCalibrationFactorStr, "-1", dbcmdTr); //result value from
sensor. Decimal is point!!
//removed on 1.37
//Insert ("encoderConfiguration", new
EncoderConfiguration().ToStringOutput(EncoderConfiguration.Outputs.SQL), dbcmdTr);
@@ -324,7 +335,6 @@ class SqlitePreferences : Sqlite
preferences.versionAvailable = reader[1].ToString();
else if(reader[0].ToString() == "runSpeedStartArrival")
preferences.runSpeedStartArrival = reader[1].ToString() == "True";
-
else if(reader[0].ToString() == "runDoubleContactsMode")
preferences.runDoubleContactsMode = (Constants.DoubleContact)
Enum.Parse(typeof(Constants.DoubleContact), reader[1].ToString());
@@ -341,6 +351,24 @@ class SqlitePreferences : Sqlite
preferences.thresholdRuns = Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "thresholdOther")
preferences.thresholdOther = Convert.ToInt32(reader[1].ToString());
+
+ //force sensor tare
+ else if(reader[0].ToString() == ForceSensorTareDateTimeStr)
+ preferences.forceSensorTareDateTime = reader[1].ToString();
+ else if(reader[0].ToString() == ForceSensorTareStr)
+ preferences.forceSensorTare = Convert.ToDouble(
+ Util.ChangeDecimalSeparator(reader[1].ToString()));
+
+ //force sensor calibrate
+ else if(reader[0].ToString() == ForceSensorCalibrationDateTimeStr)
+ preferences.forceSensorCalibrationDateTime = reader[1].ToString();
+ else if(reader[0].ToString() == ForceSensorCalibrationWeightStr)
+ preferences.forceSensorCalibrationWeight = Convert.ToDouble(
+ Util.ChangeDecimalSeparator(reader[1].ToString()));
+ else if(reader[0].ToString() == ForceSensorCalibrationFactorStr)
+ preferences.forceSensorCalibrationFactor = Convert.ToDouble(
+ Util.ChangeDecimalSeparator(reader[1].ToString()));
+
//advanced tab
else if(reader[0].ToString() == "digitsNumber")
preferences.digitsNumber = Convert.ToInt32(reader[1].ToString());
@@ -348,7 +376,6 @@ class SqlitePreferences : Sqlite
preferences.askDeletion = reader[1].ToString() == "True";
else if(reader[0].ToString() == "muteLogs")
preferences.muteLogs = reader[1].ToString() == "True";
-
else if(reader[0].ToString() == "machineID")
preferences.machineID = reader[1].ToString();
else if(reader[0].ToString() == "multimediaStorage")
diff --git a/src/util.cs b/src/util.cs
index 4bac7c8..30545cd 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -94,6 +94,7 @@ public class Util
//used for load from the database all numbers with correct decimal separator (locale defined)
//used also for the tvString, tcString, and runIntervalTimesString
+ //also used for reading . data coming from force sensor
public static string ChangeDecimalSeparator(string myString) {
if(myString == "") {
return "0";
diff --git a/src/utilDate.cs b/src/utilDate.cs
index ca4caa6..c9aa774 100644
--- a/src/utilDate.cs
+++ b/src/utilDate.cs
@@ -37,6 +37,7 @@ public class UtilDate
}
//records date & time, useful to backup database without having strange chars on filename
+ //used also on SQL when time wants to be stored also
public static string ToFile (DateTime dt)
{
return UtilAll.DigitsCreate(dt.Year,4) + "-" +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]