MeterResetPsu:

- Clear display before any further operation
- StoreConfigurations if selected in check-box
This commit is contained in:
Thomas Wiedebusch
2022-08-16 11:07:59 +02:00
parent 4a5a7da7c1
commit c8aea75791
9 changed files with 113 additions and 57 deletions
+2 -2
View File
@@ -14,5 +14,5 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.3.0.*")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: AssemblyVersion("2.3.1.*")]
[assembly: AssemblyFileVersion("2.3.1.0")]
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\ProgrammeSensus\Repo\Lab\La_Operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -30,6 +30,10 @@
/// </summary>
StartInitial,
/// <summary>
/// Store configuration
/// </summary>
StoreConfigurations,
/// <summary>
/// Build the FLEXNETVERSION file upg18
/// </summary>
BuildUpgradeFile,
@@ -37,17 +37,20 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
StateInfos[5].State = MeterResetPsuState.StartInitial;
StateInfos[5].Message = "Initial start";
StateInfos[6].State = MeterResetPsuState.BuildUpgradeFile;
StateInfos[6].Message = "Build flexnetversion upgrade file";
StateInfos[6].State = MeterResetPsuState.StoreConfigurations;
StateInfos[6].Message = "Store configurations of all apps";
StateInfos[7].State = MeterResetPsuState.DownloadUpgradeFile;
StateInfos[7].Message = "Download flexnetversion upgrade file";
StateInfos[7].State = MeterResetPsuState.BuildUpgradeFile;
StateInfos[7].Message = "Build flexnetversion upgrade file";
StateInfos[8].State = MeterResetPsuState.DownloadUpgradeCtrlFile;
StateInfos[8].Message = "Download upgrade control file";
StateInfos[8].State = MeterResetPsuState.DownloadUpgradeFile;
StateInfos[8].Message = "Download flexnetversion upgrade file";
StateInfos[9].State = MeterResetPsuState.TriggerUpgrade;
StateInfos[9].Message = "Trigger upgrade";
StateInfos[9].State = MeterResetPsuState.DownloadUpgradeCtrlFile;
StateInfos[9].Message = "Download upgrade control file";
StateInfos[10].State = MeterResetPsuState.TriggerUpgrade;
StateInfos[10].Message = "Trigger upgrade";
}
@@ -96,6 +96,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
// manual stop of update process
private Boolean _stopUpdateProcess;
/// <summary>
/// Store configuration in advance to the update
/// </summary>
public Boolean StoreConfigEnable = true;
#endregion
#region Events
@@ -366,6 +371,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Aug-10" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2022-Aug-16" author="Thomas Wiedebusch">
/// - Store configurations added
/// </remarks>
private void MeterResetPsuStateMachine()
{
if (_backupMeterResetPsuState == _meterResetPsuState)
@@ -376,6 +384,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
// remind backup state to avoid repeated execution and side effects
_backupMeterResetPsuState = _meterResetPsuState;
// set actual state info text, this can be overwritten by each routine
_actualOperation = MeterResetPsuStateInfo.GetTextFromState(_meterResetPsuState);
switch (_meterResetPsuState)
{
case MeterResetPsuState.Idle:
@@ -383,7 +393,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
case MeterResetPsuState.StartInitial:
_processRetryCtr = 0;
_meterResetPsuState = MeterResetPsuState.BuildUpgradeFile;
_meterResetPsuState = MeterResetPsuState.StoreConfigurations;
break;
case MeterResetPsuState.StoreConfigurations:
_meterResetPsuState = StoreConfigurations() ? MeterResetPsuState.BuildUpgradeFile :
MeterResetPsuState.StepFailed;
break;
case MeterResetPsuState.BuildUpgradeFile:
@@ -445,6 +460,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
#endregion
#region Operation
/// <summary>
/// Store configurations before reset, because reboot will use the values
/// of the non volatile memory.
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Aug-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean StoreConfigurations()
{
if (_genesisMeter == null)
{
return false;
}
return !StoreConfigEnable || _genesisMeter.StoreAllConfigurations();
}
/// <summary>
/// Build the upgrade for FLEXNETVERSION
/// </summary>
@@ -1 +1 @@
46bd00889699f5a20a4981a22f62b66368323855
1a3d4919c9c702245832d925951f2b7cb72fc333
@@ -1 +1 @@
81d60b90addc793525740e9993e19bf6665bd401
f64d563def603c89cafafa61a3219ba97e1e344c
+23 -7
View File
@@ -1378,7 +1378,15 @@ namespace Xylem.Common.Ui.GenesisToolBox
// reset the time
_startTime = DateTimeOffset.UtcNow;
_meterResetPsu = new MeterResetPsu(_currentGenesis);
// clear display before store configuration
btnClearDisplay_Click(this, null);
_meterResetPsu = new MeterResetPsu(_currentGenesis)
{
StoreConfigEnable = cbxStoreConfigEnable.Checked
};
_meterResetProcessActive = true;
SetControlsDownloadIsOngoing();
@@ -1581,9 +1589,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
#region ExternalCalls
public Boolean Prepare(Int32 slot, String binaryPath, String packageInfoPath)
{
_updateGui = false;
@@ -1867,18 +1872,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
if (_currentGenesis == null)
return;
lblOverall.Text = @"Set display to normal operation";
lblOverall.Visible = true;
Update();
if (!_currentGenesis.IsLoggedOn)
{
_currentGenesis.Login();
_currentGenesis.ReLogin();
}
_currentGenesis.SetLcdText(true, new Byte[] { 0x00, 0x00, 0x00, 0x00 });
_currentGenesis.Logout();
lblOverall.Visible = false;
}
private void btnFixBat_Click(Object sender, EventArgs e)
{
_currentGenesis.Login();
lblOverall.Text = @"Fix battery settings";
lblOverall.Visible = true;
Update();
_currentGenesis.ReLogin();
_currentGenesis.WriteRegister("GENESISFLOW_SealDisplay", (UInt32)0);
_currentGenesis.ResetAlarm(GenesisMeter.Alarm.ALL);
@@ -1892,7 +1907,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
_currentGenesis.Logout();
Thread.Sleep(5000);
_currentGenesis.Login();
_currentGenesis.ReLogin();
lblOverall.Visible = false;
}
private void cbxStoreConfigEnable_CheckedChanged(Object sender, EventArgs e)
+28 -28
View File
@@ -56,6 +56,7 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnLoadfromDb = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.rbtProd = new System.Windows.Forms.RadioButton();
this.cbxDbLuts = new System.Windows.Forms.ComboBox();
@@ -73,7 +74,6 @@
this.label9 = new System.Windows.Forms.Label();
this.lblUpdateTime = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.btnLoadfromDb = new System.Windows.Forms.Button();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
@@ -248,7 +248,7 @@
//
// btnStopFwUpdate
//
this.btnStopFwUpdate.Location = new System.Drawing.Point(310, 219);
this.btnStopFwUpdate.Location = new System.Drawing.Point(310, 216);
this.btnStopFwUpdate.Name = "btnStopFwUpdate";
this.btnStopFwUpdate.Size = new System.Drawing.Size(116, 25);
this.btnStopFwUpdate.TabIndex = 8;
@@ -258,7 +258,7 @@
//
// btnDownloadLutFile
//
this.btnDownloadLutFile.Location = new System.Drawing.Point(310, 188);
this.btnDownloadLutFile.Location = new System.Drawing.Point(310, 183);
this.btnDownloadLutFile.Name = "btnDownloadLutFile";
this.btnDownloadLutFile.Size = new System.Drawing.Size(116, 25);
this.btnDownloadLutFile.TabIndex = 0;
@@ -358,10 +358,20 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Lookup Table File";
//
// btnLoadfromDb
//
this.btnLoadfromDb.Location = new System.Drawing.Point(310, 118);
this.btnLoadfromDb.Name = "btnLoadfromDb";
this.btnLoadfromDb.Size = new System.Drawing.Size(116, 26);
this.btnLoadfromDb.TabIndex = 20;
this.btnLoadfromDb.Text = "Load from Db";
this.btnLoadfromDb.UseVisualStyleBackColor = true;
this.btnLoadfromDb.Click += new System.EventHandler(this.btnLoadfromDb_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 28);
this.label4.Location = new System.Drawing.Point(12, 30);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(68, 13);
this.label4.TabIndex = 19;
@@ -370,7 +380,7 @@
// rbtProd
//
this.rbtProd.AutoSize = true;
this.rbtProd.Location = new System.Drawing.Point(270, 24);
this.rbtProd.Location = new System.Drawing.Point(270, 28);
this.rbtProd.Name = "rbtProd";
this.rbtProd.Size = new System.Drawing.Size(96, 17);
this.rbtProd.TabIndex = 18;
@@ -382,7 +392,7 @@
// cbxDbLuts
//
this.cbxDbLuts.FormattingEnabled = true;
this.cbxDbLuts.Location = new System.Drawing.Point(82, 53);
this.cbxDbLuts.Location = new System.Drawing.Point(90, 58);
this.cbxDbLuts.Name = "cbxDbLuts";
this.cbxDbLuts.Size = new System.Drawing.Size(333, 21);
this.cbxDbLuts.TabIndex = 17;
@@ -392,7 +402,7 @@
// rbtDb
//
this.rbtDb.AutoSize = true;
this.rbtDb.Location = new System.Drawing.Point(150, 24);
this.rbtDb.Location = new System.Drawing.Point(144, 28);
this.rbtDb.Name = "rbtDb";
this.rbtDb.Size = new System.Drawing.Size(120, 17);
this.rbtDb.TabIndex = 16;
@@ -404,7 +414,7 @@
// rbtFile
//
this.rbtFile.AutoSize = true;
this.rbtFile.Location = new System.Drawing.Point(103, 24);
this.rbtFile.Location = new System.Drawing.Point(87, 28);
this.rbtFile.Name = "rbtFile";
this.rbtFile.Size = new System.Drawing.Size(41, 17);
this.rbtFile.TabIndex = 15;
@@ -416,7 +426,7 @@
// lblSelectDb
//
this.lblSelectDb.AutoSize = true;
this.lblSelectDb.Location = new System.Drawing.Point(12, 58);
this.lblSelectDb.Location = new System.Drawing.Point(12, 62);
this.lblSelectDb.Name = "lblSelectDb";
this.lblSelectDb.Size = new System.Drawing.Size(64, 13);
this.lblSelectDb.TabIndex = 14;
@@ -425,7 +435,7 @@
//
// tbxFileMeterSize
//
this.tbxFileMeterSize.Location = new System.Drawing.Point(104, 223);
this.tbxFileMeterSize.Location = new System.Drawing.Point(91, 148);
this.tbxFileMeterSize.Name = "tbxFileMeterSize";
this.tbxFileMeterSize.ReadOnly = true;
this.tbxFileMeterSize.Size = new System.Drawing.Size(68, 20);
@@ -433,7 +443,7 @@
//
// tbxFileCrc
//
this.tbxFileCrc.Location = new System.Drawing.Point(104, 193);
this.tbxFileCrc.Location = new System.Drawing.Point(91, 118);
this.tbxFileCrc.Name = "tbxFileCrc";
this.tbxFileCrc.ReadOnly = true;
this.tbxFileCrc.Size = new System.Drawing.Size(68, 20);
@@ -442,7 +452,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 227);
this.label3.Location = new System.Drawing.Point(12, 152);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(79, 13);
this.label3.TabIndex = 11;
@@ -451,7 +461,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 197);
this.label1.Location = new System.Drawing.Point(12, 121);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(75, 13);
this.label1.TabIndex = 10;
@@ -460,7 +470,7 @@
// lblLutFileLoadedInfo
//
this.lblLutFileLoadedInfo.AutoSize = true;
this.lblLutFileLoadedInfo.Location = new System.Drawing.Point(6, 107);
this.lblLutFileLoadedInfo.Location = new System.Drawing.Point(190, 121);
this.lblLutFileLoadedInfo.Name = "lblLutFileLoadedInfo";
this.lblLutFileLoadedInfo.Size = new System.Drawing.Size(97, 13);
this.lblLutFileLoadedInfo.TabIndex = 9;
@@ -468,7 +478,7 @@
//
// tbxLutFilePathName
//
this.tbxLutFilePathName.Location = new System.Drawing.Point(82, 76);
this.tbxLutFilePathName.Location = new System.Drawing.Point(90, 85);
this.tbxLutFilePathName.Name = "tbxLutFilePathName";
this.tbxLutFilePathName.ReadOnly = true;
this.tbxLutFilePathName.Size = new System.Drawing.Size(333, 20);
@@ -478,7 +488,7 @@
// lvlSelechtFile
//
this.lvlSelechtFile.AutoSize = true;
this.lvlSelechtFile.Location = new System.Drawing.Point(10, 79);
this.lvlSelechtFile.Location = new System.Drawing.Point(12, 88);
this.lvlSelechtFile.Name = "lvlSelechtFile";
this.lvlSelechtFile.Size = new System.Drawing.Size(63, 13);
this.lvlSelechtFile.TabIndex = 1;
@@ -487,7 +497,7 @@
//
// btnOpenLutFile
//
this.btnOpenLutFile.Location = new System.Drawing.Point(310, 156);
this.btnOpenLutFile.Location = new System.Drawing.Point(310, 150);
this.btnOpenLutFile.Name = "btnOpenLutFile";
this.btnOpenLutFile.Size = new System.Drawing.Size(116, 26);
this.btnOpenLutFile.TabIndex = 0;
@@ -523,22 +533,12 @@
this.label7.TabIndex = 32;
this.label7.Text = "Cordonel LUT Update";
//
// btnLoadfromDb
//
this.btnLoadfromDb.Location = new System.Drawing.Point(310, 124);
this.btnLoadfromDb.Name = "btnLoadfromDb";
this.btnLoadfromDb.Size = new System.Drawing.Size(116, 26);
this.btnLoadfromDb.TabIndex = 20;
this.btnLoadfromDb.Text = "Load from Db";
this.btnLoadfromDb.UseVisualStyleBackColor = true;
this.btnLoadfromDb.Click += new System.EventHandler(this.btnLoadfromDb_Click);
//
// FrmLutUpdate
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(723, 461);
this.ClientSize = new System.Drawing.Size(723, 418);
this.Controls.Add(this.label7);
this.Controls.Add(this.lblUpdateTime);
this.Controls.Add(this.label9);