mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 03:05:32 -06:00
Check for zero throttle
This commit is contained in:
parent
db0d0e9f81
commit
a4dac712a5
@ -70,17 +70,17 @@ object Event {
|
||||
for {
|
||||
seconds <- getMember("seconds", UInt.MaxValue)
|
||||
useconds <- getMember("useconds", 999_999)
|
||||
_ <- {
|
||||
if (seconds + useconds) > 0 then Right(())
|
||||
else Left(SemanticError.InvalidEvent(
|
||||
loc, "time interval may not be zero"
|
||||
))
|
||||
}
|
||||
} yield TimeInterval(seconds, useconds.toInt)
|
||||
}
|
||||
def checkEventThrottle(throttle: AstNode[Ast.EventThrottle]) = {
|
||||
for {
|
||||
count <- a.getNonnegativeIntValue(throttle.data.count.id)
|
||||
_ <- {
|
||||
if count > 0 then Right(())
|
||||
else Left(SemanticError.InvalidIntValue(
|
||||
loc, 0, s"event throttle count must be greater than 0"
|
||||
))
|
||||
}
|
||||
every <- Result.mapOpt(throttle.data.every, getEveryIntervalValue)
|
||||
} yield Throttle(count, every)
|
||||
}
|
||||
|
||||
@ -20,5 +20,5 @@ not_displayable
|
||||
ok
|
||||
ref_params
|
||||
throttle_too_large
|
||||
zero_throttle_interval
|
||||
zero_throttle_count
|
||||
"
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
passive component C {
|
||||
|
||||
event E severity activity low \
|
||||
format "" throttle 10 \
|
||||
every {seconds=0}
|
||||
format "" throttle 0
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/event/zero_throttle_count.fpp:3.3
|
||||
event E severity activity low \
|
||||
^
|
||||
error: invalid integer value 0
|
||||
event throttle count must be greater than 0
|
||||
@ -1,5 +0,0 @@
|
||||
fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/event/zero_throttle_interval.fpp:5.11
|
||||
every {seconds=0}
|
||||
^
|
||||
error: time interval may not be zero
|
||||
@ -6106,7 +6106,7 @@ argument whose type is a <a href="#Types_Internal-Types_Numeric-Types">numeric t
|
||||
count</strong> for instances of <em>E</em>.
|
||||
The type of <em>e</em> must be convertible to
|
||||
<a href="#Types_Internal-Types_Integer"><em>Integer</em></a> and must evaluate to an integer
|
||||
in the range \$[0, 2^31)\$.
|
||||
in the range \$[1, 2^31)\$.
|
||||
When throttling is specified for an event <em>E</em>,
|
||||
the framework maintains a <strong>throttle count</strong> for <em>E</em>.
|
||||
The throttle count
|
||||
@ -6128,11 +6128,11 @@ period</strong>.
|
||||
<li>
|
||||
<p>After conversion to <em>T</em>, <em>e</em> must evaluate to an
|
||||
<a href="#Values_Anonymous-Struct-Values">anonymous struct value</a>
|
||||
<code>{ seconds =</code> <em>s</em> <code>:U32, useconds =</code> <em>u</em> <code>:U32 }</code>.</p>
|
||||
<code>{ seconds =</code> <em>s</em> <code>: U32, useconds =</code> <em>u</em> <code>: U32 }</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><em>s</em> must be in the range \$[0, 2^32)\$, <em>u</em> must be in the range
|
||||
\$[0,10^6)\$, and \$s + u\$ must be greater than zero.</p>
|
||||
<p><em>s</em> must be in the range \$[0, 2^32)\$ and <em>u</em> must be in the range
|
||||
\$[0,10^6)\$.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -11889,7 +11889,7 @@ equivalent.</p>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2025-09-22 16:49:32 -0700
|
||||
Last updated 2025-09-24 16:18:38 -0700
|
||||
</div>
|
||||
</div>
|
||||
<script src="code-prettify/run_prettify.js"></script>
|
||||
|
||||
@ -15700,7 +15700,7 @@ serialized according to its
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2025-09-22 11:13:20 -0700
|
||||
Last updated 2025-09-24 16:07:50 -0700
|
||||
</div>
|
||||
</div>
|
||||
<script src="code-prettify/run_prettify.js"></script>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="generator" content="Asciidoctor 2.0.20">
|
||||
<meta name="generator" content="Asciidoctor 2.0.23">
|
||||
<title>F Prime Prime (FPP)</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
|
||||
<style>
|
||||
@ -140,7 +140,7 @@ p a>code:hover{color:rgba(0,0,0,.9)}
|
||||
#content::before{content:none}
|
||||
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
|
||||
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
|
||||
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
|
||||
#header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px}
|
||||
#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}
|
||||
#header .details span:first-child{margin-left:-.125em}
|
||||
#header .details span.email a{color:rgba(0,0,0,.85)}
|
||||
@ -162,6 +162,7 @@ p a>code:hover{color:rgba(0,0,0,.9)}
|
||||
#toctitle{color:#7a2518;font-size:1.2em}
|
||||
@media screen and (min-width:768px){#toctitle{font-size:1.375em}
|
||||
body.toc2{padding-left:15em;padding-right:0}
|
||||
body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
|
||||
#toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
|
||||
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
|
||||
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
|
||||
@ -327,7 +328,7 @@ a.image{text-decoration:none;display:inline-block}
|
||||
a.image object{pointer-events:none}
|
||||
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
|
||||
sup.footnote a,sup.footnoteref a{text-decoration:none}
|
||||
sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
|
||||
sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline}
|
||||
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
|
||||
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
|
||||
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
|
||||
@ -463,7 +464,7 @@ generated code.</p>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2025-02-18 09:43:03 -0800
|
||||
Last updated 2025-03-17 09:56:45 -0700
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -71,7 +71,7 @@ argument whose type is a <<Types_Internal-Types_Numeric-Types,numeric type>>.
|
||||
count* for instances of _E_.
|
||||
The type of _e_ must be convertible to
|
||||
<<Types_Internal-Types_Integer,_Integer_>> and must evaluate to an integer
|
||||
in the range stem:[[0, 2^31)].
|
||||
in the range stem:[[1, 2^31)].
|
||||
When throttling is specified for an event _E_,
|
||||
the framework maintains a *throttle count* for _E_.
|
||||
The throttle count
|
||||
@ -90,10 +90,10 @@ anonymous struct type>> _T =_ `{ seconds: U32, useconds: U32 }`.
|
||||
|
||||
*** After conversion to _T_, _e_ must evaluate to an
|
||||
<<Values_Anonymous-Struct-Values,anonymous struct value>>
|
||||
`{ seconds =` _s_ `:U32, useconds =` _u_ `:U32 }`.
|
||||
`{ seconds =` _s_ `: U32, useconds =` _u_ `: U32 }`.
|
||||
|
||||
*** _s_ must be in the range stem:[[0, 2^32)], _u_ must be in the range
|
||||
stem:[[0,10^6)], and stem:[s + u] must be greater than zero.
|
||||
*** _s_ must be in the range stem:[[0, 2^32)] and _u_ must be in the range
|
||||
stem:[[0,10^6)].
|
||||
|
||||
+
|
||||
+
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user