Tasks#

Small Linux (Busybox)#

  • ramdisk, early boot

  • -> Yocto

Graceful Termination (Done)#

DingsbumsSPS

  • In bin/run-door.cpp introduce signal handling for SIGINT and SIGTERM

  • … to terminate gracefully, drop out of the main loop

  • Before exit, perform necessary cleanup (done by destructors, mostly), and print a “bye” message.

sysfs GPIO (Done)#

Reinraus

  • Yet another {In,Out}putSwitch implementation

  • Advantage: relieves us (for a moment) from the pain of libgpiod.

  • There is this one loopback test where one IO sees immediately the update of another - this is fragile, we want to see that test pass :-)

  • Probably write some nice helper routines to read/write typical sysfs files

please

Structural Refactoring (Ongoing)#

Abrissbirne

  • Konzept: structure diagram, dependency diagram in gh/README.rst

  • Include paths? Siehe task How to include files (Done)

  • Dependencies (cmake --graphviz), see Visualizing Dependencies

  • Coordinate with other teams

  • Remove libgpiod usage from unit tests

  • Rollout of {In,Out}putSwitch, and especially of {In,Out}putSwitchGPIO, we are for a moment safe from libgpiod woes.

    Eliminate all uses of libgpiod, in favor of the {In,Out}putSwitch interface.

    • MotorLED (if not yet done)

    • MotorStepper (if not yet done)

Test Rack (Ongoing)#

DieSeinigen

  • Define the software implications of using this as door environment

  • How do we create input to our inputs? See src/door/structs.h. Discuss with PLC guys (aka DingsbumsSPS)

  • How would Motor interface be implemented?

  • jfasch to ask msallok if we can borrow the panel for integration tests, occasionally

Analog Sensor Interface (Ongoing)#

Unify pressure sensor and adc (1115) under the hood of one AnalogSensor interface where you can use get_value() -> double.

@startuml

interface AnalogSensor {
  + double get_value()
}

class PressureSensorBMP { }
class ADC1115 {}
class MockSensor {}

AnalogSensor <|.. PressureSensorBMP
AnalogSensor <|.. ADC1115
AnalogSensor <|.. MockSensor

@enduml

Integration Tests (Ongoing)#

  • Based on some configuration (commandline switch, like --test, or variations like --half-real), instantiate objects polymorphically.

  • To instantiate these objects, you need to define hardware parameters

    • GPIO pins. Coordinate with sysfs GPIO (Done) for sysfs GPIO parameters, and probably find a way to unify those with the future libgpiod parameters.

    • I2C bus numbers and addresses for pressure sensor and ADC (coordinate with these guys regarding parameterization)

    • PWM config. how’s that done? need to define a PWM task that makes something like this true:

      • period, set at the beginning (of what), used throughout lifetime

      • Users would then probably measure their share of the period in percent

      • Or, like the stepper motor, be constructed with a proposed duty_cycle for each of forward, backward, stop, like

        PWMPin pwm(/*chip=*/0, /*channel=*/0, /*period=*/10_000_000);
        OutputSwitchGPIOSysfs direction = ... ; // oder so
        OutputSwitchGPIOSysfs wasnoch = ... ; // fuer was war der zweite gleich?
        
        MotorStepper motor(&pwm, &direction, &wasnoch,
                           /*left=*/2_000_000, /*idle=*/5_000_000, /*right=*/8_000_000);
        
        motor.forward(); // <-- see what happens
        
  • Anyway: one we have polymorphic HW objects, we can pass those into Inputs() and Outputs()

=delete Copy Where Appropriate (Done)#

Knepferldrucker

  • Find out list of such candidates (all the GPIO switches, supposedly, as a start)

  • Discuss

  • Fix

A Textual User Interface#

(See https://www.textualize.io/)

Write a management application (reachable over the terminal/SSH) for tasks like

  • Log viewing. Requires that we have a log somewhere; could have one that is e.g. buried in sqlite3 — DB-API 2.0 interface for SQLite databases

  • Input event injection (e.g. “close-button” pressed)

  • Various hardware testing features, like moving the motor back and forth and measure various things

RFID Reader?#

  • Flipper Zero as a starting point (read payload with something that works)

  • Raspi/I2C to a reader device

  • Open/close as reader devices

How to include files (Done)#

  • file.cpp includes its own file.h, or any other file from the same directory. Such files are included like #include ""

    • Right: #include "file.h"

    • Wrong: #include <door/file.h>

    $ pwd
    /home/jfasch/My-Projects/FH-STECE2023/src/door
    $ grep 'door/' *.h *.cpp
    event-edge-detector.h:#include <door/input-switch.h>
    event-edge-detector.h:#include <door/timespec.h>
    outputs.h:#include <door/structs.h>
    outputs.h:#include <door/motor.h>
    event-edge-detector.cpp:#include <door/event-edge-detector.h>
    outputs.cpp:#include <door/motor.h>
    
  • file.h or file.cpp in directory A includes anotherfile.h from directory B

    • Wrong: #include <../B/anotherfile.h>

    • Right: #include <B/anotherfile.h> - and a dependency declaration A -> B in A/CMakeLists.txt

    $ pwd
    /home/jfasch/My-Projects/FH-STECE2023/tests
    $ grep 'include.*\.\.' *.cpp
    input-switch-gpio-tests.cpp:#include "../src/door/input-switch-gpio.h"
    light-barrier-gpio-tests.cpp:#include "../src/door/light-barrier-gpio.h"
    motorLED-tests.cpp:#include "../src/door/motorLED.h"
    motor-stepper-tests.cpp:#include "../src/door/motor-stepper.h"
    push-button-gpio-test.cpp:#include "../src/door/push-button-gpio.h"
    

Remove Light Barrier And Push Putton (Done)#

Knepferldrucker

Remove entirely:

door/CMakeLists.txt#
light-barrier.h
light-barrier-mock.h
light-barrier-mock.cpp

push-button.h
push-button-mock.h
push-button-mock.cpp

SPS Machinery: State Machine Not As It Was Before#

State OPENING not implemented as it was in old implementation. Old code is still there in comments, but not implemented in the new version.

Comment TEST(door_suite, straightforward_open) back in and see.

ADC/ADS1115 (Ongoing)#

HighPressure

  • Da war eine Schwellwert-Trigger-Sache ausgemacht!

  • What does PR’s adc test works when joystick is not moved and fails if moved. mean?

  • get_value(): usleep(8 * 1000) is not good for realtime operation. can the device do continuous conversion?

  • Clarify future use (motor is stuck)

Motor/Stepper#

  • writeData(): use raw file IO

  • Use OutputSwitchGPIO rather than libgpiod directly