Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sfp-plus-i2c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
sfp-plus-i2c
Commits
e641be2b
Commit
e641be2b
authored
Feb 09, 2018
by
Vincent van Beveren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Missed a location where timeout could occur
parent
69df5429
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
+44
-7
DataSource.java
sw/jsfp/src/nl/nikhef/sfp/ddmi/DataSource.java
+43
-6
nikhef-tools.jar
sw/nikhef-tools/nikhef-tools.jar
+0
-0
DollyModel.java
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyModel.java
+1
-1
No files found.
sw/jsfp/src/nl/nikhef/sfp/ddmi/DataSource.java
View file @
e641be2b
...
...
@@ -28,7 +28,7 @@ import org.luaj.vm2.LuaValue;
public
abstract
class
DataSource
{
private
final
static
int
MAX_RETRIES
=
3
;
private
final
static
int
MAX_RETRIES
=
20
;
private
String
_condition
;
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
DataSource
.
class
.
getSimpleName
());
...
...
@@ -58,8 +58,18 @@ public abstract class DataSource {
public
void
update
(
DDMIContext
ctx
)
{
byte
[]
area
=
readMedia
(
ctx
,
start
,
(
end
-
start
)
+
1
);
byte
[]
area
=
null
;
for
(
int
retry
=
0
;
retry
<
MAX_RETRIES
;
retry
++)
{
try
{
area
=
readMedia
(
ctx
,
start
,
(
end
-
start
)
+
1
);
}
catch
(
RuntimeException
re
)
{
if
(
retry
==
MAX_RETRIES
-
1
)
throw
re
;
}
}
if
(
area
==
null
)
return
;
write
(
ctx
,
offset
,
new
byte
[]
{
SFPUtils
.
checkSum
(
area
,
0
,
(
end
-
start
)
+
1
)
}
);
}
...
...
@@ -129,7 +139,20 @@ public abstract class DataSource {
}
// System.out.printf("Rescaling write, old-off=%d new-off=%d old-len=%d new-len=%d\n", off, nOff, data.length, nLen);
byte
[]
newData
=
read
(
ctx
,
nOff
,
nLen
);
byte
[]
newData
=
null
;
for
(
int
retry
=
0
;
retry
<
MAX_RETRIES
;
retry
++)
{
newData
=
read
(
ctx
,
nOff
,
nLen
);
if
(
newData
!=
null
)
break
;
try
{
Thread
.
sleep
(
10
);
}
catch
(
InterruptedException
e
)
{
}
}
if
(
newData
==
null
)
{
throw
new
RuntimeException
(
"Failed to cache EEPROM data"
);
}
System
.
arraycopy
(
data
,
0
,
newData
,
err
,
data
.
length
);
off
=
nOff
;
...
...
@@ -263,8 +286,15 @@ public abstract class DataSource {
return
c
.
read
(
ctx
,
off
,
len
);
}
}
return
readMedia
(
ctx
,
off
,
len
);
for
(
int
retry
=
0
;
retry
<
MAX_RETRIES
;
retry
++)
{
try
{
return
readMedia
(
ctx
,
off
,
len
);
}
catch
(
RuntimeException
re
)
{
if
(
retry
==
MAX_RETRIES
-
1
)
throw
re
;
}
}
throw
new
AssertionError
(
"Unreachable code"
);
}
public
void
write
(
DDMIContext
ctx
,
int
off
,
byte
[]
data
)
...
...
@@ -283,7 +313,14 @@ public abstract class DataSource {
}
writeMedia
(
ctx
,
off
,
data
);
for
(
int
retry
=
0
;
retry
<
MAX_RETRIES
;
retry
++)
{
try
{
writeMedia
(
ctx
,
off
,
data
);
}
catch
(
RuntimeException
re
)
{
if
(
retry
==
MAX_RETRIES
-
1
)
throw
re
;
}
}
}
...
...
sw/nikhef-tools/nikhef-tools.jar
View file @
e641be2b
No preview for this file type
sw/safaripark/src/nl/nikhef/safaripark/dolly/DollyModel.java
View file @
e641be2b
...
...
@@ -254,7 +254,7 @@ public class DollyModel implements SFPDeviceListener, SFPProviderListener {
DDMIValue
v
=
_selectedValues
.
get
(
_counter
);
LOG
.
info
(
"Copying value "
+
v
.
get
Label
());
LOG
.
info
(
"Copying value "
+
v
.
get
Name
());
byte
[]
value
;
try
{
value
=
_vg
.
getValue
(
v
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment