]> git.earman.xyz Git - lisp/workenv.git/commitdiff
Replace subtraction with 1-
authorrearman <rearman@r717.net>
Mon, 13 Apr 2026 20:05:02 +0000 (16:05 -0400)
committerrearman <rearman@r717.net>
Mon, 13 Apr 2026 20:05:02 +0000 (16:05 -0400)
plc.lisp

index f4ae218d12721869c532c56480cb7565700e058c..ffd37c145c3b164ec3b168df17a8a7e2adc89426 100644 (file)
--- a/plc.lisp
+++ b/plc.lisp
@@ -16,7 +16,7 @@
 
 (defun max-counts (resolution)
   "Calculate the max count for a PLC analog, given card's bit-resolution."
-  (- (^ 2 resolution) 1))
+  (1- (^ 2 resolution)))
 
 (defun volts->counts (vin)
   "Convert a voltage signal to a PLC count.