parent
a19d94ae2d
commit
34328ba305
|
@ -578,8 +578,6 @@ int main() {
|
||||||
#endif
|
#endif
|
||||||
LOG("set affinity returns %d", err);
|
LOG("set affinity returns %d", err);
|
||||||
|
|
||||||
panda_set_power(true);
|
|
||||||
|
|
||||||
while (!do_exit){
|
while (!do_exit){
|
||||||
std::vector<std::thread> threads;
|
std::vector<std::thread> threads;
|
||||||
threads.push_back(std::thread(panda_state_thread, getenv("STARTED") != nullptr));
|
threads.push_back(std::thread(panda_state_thread, getenv("STARTED") != nullptr));
|
||||||
|
|
|
@ -10,23 +10,6 @@
|
||||||
#include "messaging.hpp"
|
#include "messaging.hpp"
|
||||||
#include "panda.h"
|
#include "panda.h"
|
||||||
|
|
||||||
void panda_set_power(bool power){
|
|
||||||
#ifdef QCOM2
|
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
err += gpio_init(GPIO_STM_RST_N, true);
|
|
||||||
err += gpio_init(GPIO_STM_BOOT0, true);
|
|
||||||
|
|
||||||
err += gpio_set(GPIO_STM_RST_N, true);
|
|
||||||
err += gpio_set(GPIO_STM_BOOT0, false);
|
|
||||||
|
|
||||||
util::sleep_for(100); // 100 ms
|
|
||||||
|
|
||||||
err += gpio_set(GPIO_STM_RST_N, !power);
|
|
||||||
assert(err == 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Panda::Panda(){
|
Panda::Panda(){
|
||||||
// init libusb
|
// init libusb
|
||||||
int err = libusb_init(&ctx);
|
int err = libusb_init(&ctx);
|
||||||
|
|
|
@ -39,8 +39,6 @@ struct __attribute__((packed)) health_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void panda_set_power(bool power);
|
|
||||||
|
|
||||||
class Panda {
|
class Panda {
|
||||||
private:
|
private:
|
||||||
libusb_context *ctx = NULL;
|
libusb_context *ctx = NULL;
|
||||||
|
|
|
@ -9,7 +9,6 @@ os.environ['FILEREADER_CACHE'] = '1'
|
||||||
|
|
||||||
from common.realtime import config_realtime_process, Ratekeeper
|
from common.realtime import config_realtime_process, Ratekeeper
|
||||||
from selfdrive.boardd.boardd import can_capnp_to_can_list
|
from selfdrive.boardd.boardd import can_capnp_to_can_list
|
||||||
from selfdrive.pandad import set_panda_power
|
|
||||||
from tools.lib.logreader import LogReader
|
from tools.lib.logreader import LogReader
|
||||||
|
|
||||||
from panda import Panda
|
from panda import Panda
|
||||||
|
@ -78,7 +77,6 @@ def connect():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
set_panda_power(False)
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if "FLASH" in os.environ and PandaJungle is not None:
|
if "FLASH" in os.environ and PandaJungle is not None:
|
||||||
|
|
|
@ -5,29 +5,11 @@ import time
|
||||||
|
|
||||||
from panda import BASEDIR as PANDA_BASEDIR, Panda, PandaDFU
|
from panda import BASEDIR as PANDA_BASEDIR, Panda, PandaDFU
|
||||||
from common.basedir import BASEDIR
|
from common.basedir import BASEDIR
|
||||||
from common.gpio import gpio_init, gpio_set
|
|
||||||
from selfdrive.hardware import TICI
|
|
||||||
from selfdrive.hardware.tici.pins import GPIO_HUB_RST_N, GPIO_STM_BOOT0, GPIO_STM_RST_N
|
|
||||||
from selfdrive.swaglog import cloudlog
|
from selfdrive.swaglog import cloudlog
|
||||||
|
|
||||||
PANDA_FW_FN = os.path.join(PANDA_BASEDIR, "board", "obj", "panda.bin.signed")
|
PANDA_FW_FN = os.path.join(PANDA_BASEDIR, "board", "obj", "panda.bin.signed")
|
||||||
|
|
||||||
|
|
||||||
def set_panda_power(power=True):
|
|
||||||
if not TICI:
|
|
||||||
return
|
|
||||||
|
|
||||||
gpio_init(GPIO_STM_RST_N, True)
|
|
||||||
gpio_init(GPIO_STM_BOOT0, True)
|
|
||||||
|
|
||||||
gpio_set(GPIO_STM_RST_N, True)
|
|
||||||
gpio_set(GPIO_HUB_RST_N, True)
|
|
||||||
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
gpio_set(GPIO_STM_RST_N, not power)
|
|
||||||
|
|
||||||
|
|
||||||
def get_expected_signature():
|
def get_expected_signature():
|
||||||
try:
|
try:
|
||||||
return Panda.get_signature_from_firmware(PANDA_FW_FN)
|
return Panda.get_signature_from_firmware(PANDA_FW_FN)
|
||||||
|
@ -100,7 +82,6 @@ def update_panda():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
set_panda_power()
|
|
||||||
update_panda()
|
update_panda()
|
||||||
|
|
||||||
os.chdir(os.path.join(BASEDIR, "selfdrive/boardd"))
|
os.chdir(os.path.join(BASEDIR, "selfdrive/boardd"))
|
||||||
|
|
Loading…
Reference in New Issue