Fix backtrace on printing localized (non-ascii) error message in PLCGenerator.
traceback:
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\BeremizIDE.py", line 811, in OnMenu
getattr(self.CTR, method)()
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 1134, in _Build
IECGenRes = self._Generate_SoftPLC()
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 746, in _Generate_SoftPLC
if self._Generate_PLC_ST():
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 763, in _Generate_PLC_ST
self._getIECgeneratedcodepath())
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\PLCControler.py", line 466, in GenerateProgram
errors.append(str(ex))
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
Fix backtrace on printing localized (non-ascii) error message in PLCGenerator.
traceback:
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\BeremizIDE.py", line 811, in OnMenu
getattr(self.CTR, method)()
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 1134, in _Build
IECGenRes = self._Generate_SoftPLC()
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 746, in _Generate_SoftPLC
if self._Generate_PLC_ST():
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\ProjectController.py", line 763, in _Generate_PLC_ST
self._getIECgeneratedcodepath())
File "C:\Beremiz\targets\st\beremiz\..\..\..\beremiz\beremiz\PLCControler.py", line 466, in GenerateProgram
errors.append(str(ex))
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
Close #67
/*
Template C code used to produce target Ethercat C code.
Copyright (C) 2011-2014: Laurent BESSARD, Edouard TISSERANT
Distributed under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See COPYING file for copyrights details.
*/
#include "iec_types_all.h"
#define FREE 0
#define ACQUIRED 1
#define ANSWERED 2
long SDOLock = FREE;
extern long AtomicCompareExchange(long* atomicvar,long compared, long exchange);
int AcquireSDOLock() {
return AtomicCompareExchange(&SDOLock, FREE, ACQUIRED) == FREE;
}
void SDOAnswered() {
AtomicCompareExchange(&SDOLock, ACQUIRED, ANSWERED);
}
int HasAnswer() {
return SDOLock == ANSWERED;
}
void ReleaseSDOLock() {
AtomicCompareExchange(&SDOLock, ANSWERED, FREE);
}
int __init_etherlab_ext()
{
SDOLock = FREE;
return 0;
}
void __cleanup_etherlab_ext()
{
}
void __retrieve_etherlab_ext()
{
}
void __publish_etherlab_ext()
{
}