Index: .idea/.gitignore =================================================================== diff -u --- .idea/.gitignore (revision 0) +++ .idea/.gitignore (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml Index: .idea/dry-demo.iml =================================================================== diff -u --- .idea/dry-demo.iml (revision 0) +++ .idea/dry-demo.iml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file Index: .idea/inspectionProfiles/profiles_settings.xml =================================================================== diff -u --- .idea/inspectionProfiles/profiles_settings.xml (revision 0) +++ .idea/inspectionProfiles/profiles_settings.xml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,6 @@ + + + + \ No newline at end of file Index: .idea/misc.xml =================================================================== diff -u --- .idea/misc.xml (revision 0) +++ .idea/misc.xml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,4 @@ + + + + \ No newline at end of file Index: .idea/modules.xml =================================================================== diff -u --- .idea/modules.xml (revision 0) +++ .idea/modules.xml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file Index: .idea/runConfigurations/dry_demo.xml =================================================================== diff -u --- .idea/runConfigurations/dry_demo.xml (revision 0) +++ .idea/runConfigurations/dry_demo.xml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file Index: .idea/vcs.xml =================================================================== diff -u --- .idea/vcs.xml (revision 0) +++ .idea/vcs.xml (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Index: run.py =================================================================== diff -u -rd3a22e97fad0b715b1e9fba138236334ae7dbb6d -r6e42c76925267c05e6b5e868d028bca6c2faf46c --- run.py (.../run.py) (revision d3a22e97fad0b715b1e9fba138236334ae7dbb6d) +++ run.py (.../run.py) (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -11,8 +11,10 @@ hd_passive_mode=True dg_passive_mode=True -hd = HDSimulator(console_out=hd_console_out, passive_mode=hd_passive_mode, auto_response=hd_auto_response) -dg = DGSimulator(console_out=dg_console_out, passive_mode=dg_passive_mode, auto_response=dg_auto_response) +canbus = "can1" + +hd = HDSimulator(can_interface=canbus, console_out=hd_console_out, passive_mode=hd_passive_mode, auto_response=hd_auto_response) +dg = DGSimulator(can_interface=canbus, console_out=dg_console_out, passive_mode=dg_passive_mode, auto_response=dg_auto_response) alarm = HDAlarmsSimulator(hd.can_interface, hd.logger) while True: Index: run.sh =================================================================== diff -u --- run.sh (revision 0) +++ run.sh (revision 6e42c76925267c05e6b5e868d028bca6c2faf46c) @@ -0,0 +1,256 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file run.sh +# +# @author (last) Vy Duong +# @date (last) 31-Jan-2023 +# @author (original) Behrouz NematiPour +# @date (original) 28-Oct-2019 +# +############################################################################ + +HOME="$1" +source ./globals.sh +COUT="/dev/$(echo $(dmesg | grep "printk: console") | sed 's/.*printk: console.*\(tty.*\)].*/\1/')" +echo "COMMENT_DASH: $COMMENT_DASH " >> /home/root/post.debug +echo "HOME : $HOME " >> /home/root/post.debug +echo "COUT : $COUT " >> /home/root/post.debug +echo "POSTLOG : $POSTLOG " >> /home/root/post.debug + +DEMO_MODE=1 +P_CANBUS=can0 +V_CANBUS=can1 +if [ "$DEMO_MODE" == "1" ]; then + CANBUS=$V_CANBUS +else + CANBUS=$P_CANBUS +fi + +APP_SWITCHES="-u -a -F" # -F is to bypass the fault screen and is meant only for development. + +echo "HOME : $HOME " > /home/root/post.debug +echo "CANBUS : $CANBUS " > /home/root/post.debug + +# cleanup the POST log file +post_log_clear +post_err_clear +post_out_clear + +post_log_star " ***** " +post_log "Start: $(timestamp)" # log the current date, time + +#create folders for sd-card and usb if not exist +mkdir -p $SDCARD_MNT +mkdir -p $USB_MNT + +function setupVCAN() { + sudo modprobe vcan + sudo ip link add dev $CANBUS type vcan + sudo ip link set $CANBUS up +} + +function setupPCAN() { + ip link set $CANBUS up type can bitrate 250000 restart-ms 100 + ifconfig $CANBUS txqueuelen 4000 +} + +# ---------------------------------------- STOP denali in case running (sys not rebooted) +killall $DENALI_BIN + + +#setting up can interface ----------------- CANBus +post_log_dash " CANBus " +#current settings can be retrieved by the command below +#$ ip -details -statistics link show $CANBUS + +if [ "$DEMO_MODE" == "1" ]; then + setupVCAN + APP_SWITCHES="$APP_SWITCHES"" -q -D -A $CANBUS" +else + setupPCAN +fi + +# hoshy falling ckit + +candump $CANBUS -T1 # check if candump can successfully use the port. will terminate in 1ms +if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_CANBUS$POSTMSG_POSTFIX_PASSED" + post_log "$(ip link show $CANBUS)" # -details -statistics +else + post_log_fail "$POSTMSG_CANBUS$POSTMSG_POSTFIX_FAILED" + DEMO_MODE=0 +fi + + +#mounting sdcard -------------------------- SD-CARD +post_log_dash " SD-CARD " +mount $SDCARD_PRT $SDCARD_MNT +SDCTEST="$(mount | grep "$SDCARD_PRT on $SDCARD_MNT type $SDCARD_TYP_NAME (rw,")" +if ! [ -z "$SDCTEST" ]; then + SDINFO="$(df -h | grep -i $SDCARD_MNT)" + post_log_pass "$POSTMSG_SDCARD$POSTMSG_POSTFIX_PASSED" + post_log "$SDCTEST" + post_log "$SDINFO" +else + post_log_fail "$POSTMSG_SDCARD$POSTMSG_POSTFIX_FAILED" +fi + + +#test the touch screen -------------------- Touch +post_log_dash " Touch " +# when successfully connected and can be loaded +# Sitronix touch driver 2.10.2 Release date: 20180809 +# atmel_mxt_ts 3-004a: Direct firmware load for maxtouch.cfg failed with error -2 +# atmel_mxt_ts 3-004a: Touchscreen size X1279Y799 +# input: Atmel maXTouch Touchscreen as /devices/platform/soc@0/soc@0:bus@30800000/30a50000.i2c/i2c-3/3-004a/input/input2 +# When NOT connected +# Sitronix touch driver 2.10.2 Release date: 20180809 +TSTEST="$(dmesg | grep "input: Atmel maXTouch Touchscreen as ")" +if [ "$?" -eq 0 ]; then + post_log_pass "$POSTMSG_TOUCH$POSTMSG_POSTFIX_PASSED" + post_log "$TSTEST" +else + post_log_fail "$POSTMSG_TOUCH$POSTMSG_POSTFIX_FAILED" +fi + + +#test the RTC ----------------------------- RTC +post_log_dash " RTC" +#may not be an accurate test but sufficient for now +#and could not find a way to get the rtc clock with the higher resolusion +#it should not be confused with date command which is system date/time and not hwclock +hwclock -r # if there is any issue with rtc hwclock will show errors +if [ $? -eq 0 ]; then + RTC1=$($CMD_RTC_EPOCH) + sleep 1 + RTC2=$($CMD_RTC_EPOCH) + if [ $(($RTC2 - $RTC1)) -eq 1 ]; then + post_log_pass "$POSTMSG_RTC$POSTMSG_POSTFIX_PASSED" + else + post_log_fail "$POSTMSG_RTC$POSTMSG_POSTFIX_FAILED" + fi +fi + + +# ----------------------------------------- Bluetooth +post_log_dash " Bluetooth " +/usr/share/silex-uart/silex-uart.sh start 1>> $POSTOUT 2>> $POSTERR +sleep 5 +hciconfig hci0 up +if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_PASSED" + post_log "$(hciconfig hci0)" +else + post_log_fail "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_FAILED" +fi + + +# ----------------------------------------- WiFi +post_log_dash " WiFi " + +# create the wpa supplicant folder for conf storing +WPA_SUPPLICANT_DIR="/etc/wpa_supplicant/" +mkdir -p $WPA_SUPPLICANT_DIR + +# remove any software blocks +rfkill unblock wlan + +if [[ ! -z $(dmesg | grep "wlan: driver loaded") ]]; then + post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED" + post_log "$(dmesg | grep -i wlan:)" + post_log "$(ip link show wlan0)" # -details -statistics +else + post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" +fi + +# start the wpa_supplicant service +systemctl start wpa_supplicant@wlan0.service +if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED" +else + post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" + post_log"$(systemctl --failed | grep wpa)" +fi + + +# ----------------------------------------- Sha256Sum +post_log_dash " Sha256Sum " +#check the denali applicatoin checksum +SHA_ACT=$(tail -c 83 $HOME/$DENALI_BIN | cut -c19-82) +SHA_EXP=$(head -c -83 $HOME/$DENALI_BIN | sha256sum -b --tag | cut -c14-77) +if [ "$SHA_ACT" == "$SHA_EXP" ]; then + post_log_pass "$POSTMSG_SHASUM$POSTMSG_POSTFIX_PASSED" +else + post_log_fail "$POSTMSG_SHASUM$POSTMSG_POSTFIX_FAILED" +fi + + +# ----------------------------------------- CloudSync +post_log_dash " CloudSync " +if [ -d $HOME/$CLOUDSYNC_FOLDER ]; then + # moving/ backing up the previous treatment logs so the new buff starts with fresh sequence + echo "Backing up CloudSync I/O buff" + CLOUDSYNC_PATH="$SDCARD_MNT"/"$CLOUDSYNC_FOLDER" + CLOUDSYNC_BACKUP="$CLOUDSYNC_PATH"_backup/$(timestamp)/ + mkdir -p $CLOUDSYNC_BACKUP + mv $CLOUDSYNC_PATH/* $CLOUDSYNC_BACKUP 1>> $POSTOUT 2>> $POSTERR + rm $HOME/$CLOUDSYNC_FOLDER/data/* 1>> $POSTOUT 2>> $POSTERR + cd $HOME/$CLOUDSYNC_FOLDER/ + python3 ./cs.py start & + sleep 2 + CLOUDSYNC_STATUS="$(python3 ./cs.py status)" + if [ "$CLOUDSYNC_STATUS" == "$POSTMSG_CLOUDSYNC_RUNNING" ]; then + post_log_pass "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_PASSED" + else + post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" + fi + post_log "$CLOUDSYNC_STATUS" + cd +else + post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" +fi + + +# ----------------------------------------- Denali +post_log_dash " Denali " +#launching denali application +DENALI_VERSION="$($HOME/$DENALI_BIN -v)" +if [ -n "$DENALI_VERSION" ]; then + post_log_pass "$DENALI_VERSION" # log UI Software version + $HOME/$DENALI_BIN $APP_SWITCHES & +else + post_log_fail "Unknown Applicaion Version" +fi + + +# ----------------------------------------- Demo Mode +if [ "$DEMO_MODE" == "1" ]; then + sleep 2 + post_log_dash " Demo Mode " + #launching dry-demo application + cd $HOME/dry-demo + ./run.py > $HOME/dry-demo.log & + post_log $(ps ax | grep -v grep | grep "/usr/bin/python3 ./run.py") + post_log "Dry-Demo started" +fi + + +# ----------------------------------------- END +# tag the end time in the POST log file +post_log "End: $(timestamp)" +post_log_star " ***** " + +# ----------------------------------------- Ethernet +# setup ethernet +# note: At this time the application is running and also the ehternet connection is not necessary +# so the sleep here is not hurtung any part of the applicaion progress. +sleep 10 +udhcpc eth0 & + +exit 0