completate pulizie e semplificazioni varie

This commit is contained in:
Samuele E. Locatelli
2018-01-17 11:17:41 +01:00
parent 596b75ce8d
commit e247b297ee
3 changed files with 11 additions and 16 deletions
+4 -10
View File
@@ -1675,8 +1675,7 @@ namespace MTC_Adapter
}
catch
{ }
int resto = 0;
Math.DivRem(BitNum, 8, out resto);
Math.DivRem(BitNum, 8, out int resto);
string memAddr = string.Format("{0}.{1}", ByteNum + shift * memSize, resto);
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
}
@@ -1700,8 +1699,7 @@ namespace MTC_Adapter
}
catch
{ }
int resto = 0;
Math.DivRem(numRiga, 8 * memSize, out resto);
Math.DivRem(numRiga, 8 * memSize, out int resto);
string memAddr = string.Format("{0}{1}.{2}", memPre, baseAddr + shift, resto);
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
}
@@ -2142,10 +2140,7 @@ namespace MTC_Adapter
tryConnect();
}
}
if (eh_refreshed != null)
{
eh_refreshed(this, new EventArgs());
}
eh_refreshed?.Invoke(this, new EventArgs());
}
public void resetDebugConsole()
@@ -2555,8 +2550,7 @@ namespace MTC_Adapter
// 2016.10.18 aggiungo scrittura del bit di "watchdog" al primo bit della DW2... come resto tra secondi / 2
if (utils.CRB("sendWatchDog"))
{
int resto = 0;
Math.DivRem(DateTime.Now.Second / utils.CRI("cycleWatchDog"), 2, out resto);
Math.DivRem(DateTime.Now.Second / utils.CRI("cycleWatchDog"), 2, out int resto);
setFlag = resto != 0;
// se watchdog è cambiato lo invio, altrimenti lascio come è...
if (setFlag != lastWatchDog)
+1 -2
View File
@@ -837,8 +837,7 @@ namespace MTC_Adapter
{
int memIndex = 5000 + 1 * j / 2; // dovrebeb leggere correttamente solo 1 byte...
byte[] byteMtrx = new byte[1];
int resto = 0;
Math.DivRem(j, 2, out resto);
Math.DivRem(j, 2, out int resto);
inizio = DateTime.Now;
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, resto, ref byteMtrx);
int8Mem = byteMtrx[0];
+6 -4
View File
@@ -255,10 +255,12 @@ namespace MTC_Adapter
private void btnCreateFile_Click(object sender, EventArgs e)
{
// creo un nuovo file adapter...
AdapterConf c = new AdapterConf();
// nome da txtbox, vers 1
c.NomeAdapt = txtAdapter.Text;
c.Version = 1;
AdapterConf c = new AdapterConf
{
// nome da txtbox, vers 1
NomeAdapt = txtAdapter.Text,
Version = 1
};
// tipo da selettore
string valTipo = "";
try