Skip to content

Commit 97b5a11

Browse files
Fix for keys
1 parent eb35447 commit 97b5a11

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

trikControl/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Use it if JCx ports are configured to work as PWM signal generators.
205205
<i2c path="/dev/i2c-2" deviceId="0x48" />
206206

207207
<!-- Settings for virtual camera line sensor. -->
208-
<lineSensor script="/etc/init.d/line-sensor-ov7670.sh" inputFile="/run/line-sensor.in.fifo" outputFile="/run/line-sensor.out.fifo" toleranceFactor="1.0" disabled="false" />
208+
<lineSensor script="/etc/init.d/line-sensor-ov7670.sh" inputFile="/run/line-sensor-ov7670.in.fifo" outputFile="/run/line-sensor-ov7670.out.fifo" toleranceFactor="1.0" disabled="false" />
209209

210210
<!-- Settings for virtual camera object detector sensor. -->
211211
<objectSensor script="/etc/init.d/object-sensor-ov7670.sh" inputFile="/run/object-sensor.in.fifo" outputFile="/run/object-sensor.out.fifo" toleranceFactor="1.0" disabled="false" />

trikControl/src/linux/keysWorker.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ KeysWorker::KeysWorker(QString const &keysPath)
3737

3838
void KeysWorker::reset()
3939
{
40+
mLock.lockForWrite();
4041
mWasPressed.clear();
42+
mLock.unlock();
4143
}
4244

4345
bool KeysWorker::wasPressed(int code)

trikScriptRunner/src/scriptEngineWorker.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ void ScriptEngineWorker::run(QString const &script, bool inEventDrivenMode, QStr
106106
"(.*%1\\s*=\\s*\\w*\\s*function\\(.*\\).*)|(.*function\\s+%1\\s*\\(.*\\).*)").arg(function));
107107
bool const needCallFunction = !function.isEmpty() && functionRegexp.exactMatch(script)
108108
&& !script.trimmed().endsWith(function + "();");
109+
110+
mBrick.keys()->reset();
111+
109112
mEngine->evaluate(needCallFunction ? QString("%1\n%2();").arg(script, function) : script);
110113

111114
if (!mBrick.isInEventDrivenMode()) {

0 commit comments

Comments
 (0)