diff --git a/IOB-WIN-NEXT/IobSiemensSimec.cs b/IOB-WIN-NEXT/IobSiemensSimec.cs index 78d86f5e..5379caaf 100644 --- a/IOB-WIN-NEXT/IobSiemensSimec.cs +++ b/IOB-WIN-NEXT/IobSiemensSimec.cs @@ -145,6 +145,7 @@ namespace IOB_WIN_NEXT { // Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti... Dictionary taskDone = new Dictionary(); + bool writeDone = false; bool taskOk = false; string taskVal = ""; // inizio con 1 byte di default @@ -173,11 +174,11 @@ namespace IOB_WIN_NEXT case taskType.startSetup: case taskType.stopSetup: taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC"; + lgInfo(taskVal); break; case taskType.setArt: case taskType.setComm: - case taskType.setParameter: saveProdData(item); int byteSize = 0; // verifico se posso aggiornare valori in memoria... @@ -220,10 +221,19 @@ namespace IOB_WIN_NEXT { taskVal = $"NO MemMap found, SET task: {item.Key} --> {item.Value}"; } + if (!string.IsNullOrEmpty(memAddrWrite)) + { + // scrivo! + writeDone = true; + taskOk = S7WriteBB(ref MemBlock, memAddrWrite); + } + // se restituiscce "" faccio altra prova... + break; + + case taskType.setParameter: // richiedo da URL i parametri WRITE da popolare lgInfo("Chiamata processMemWriteRequests"); taskVal = processMemWriteRequests(); - // se restituiscce "" faccio altra prova... if (string.IsNullOrEmpty(taskVal)) { // i parametri me li aspetto come stringa composta paramName|paramvalue @@ -238,19 +248,13 @@ namespace IOB_WIN_NEXT } } break; - default: taskVal = "SKIPPED | NO EXEC"; break; } // aggiungo task! taskDone.Add(item.Key, taskVal); - if (!string.IsNullOrEmpty(memAddrWrite)) - { - // scrivo! - taskOk = S7WriteBB(ref MemBlock, memAddrWrite); - } - if (!taskOk) + if (!taskOk && writeDone) { lgError($"Errore in S7WriteBB durante executeTasks: {item.Key} | {item.Value}"); }