Code Monkey home page Code Monkey logo

can's People

Contributors

pojd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

eadile mechamonk

can's Issues

Extend canRelay mappings to be configurable over CAN

Change the 2 joined maps of canID -> output number -> port and bit to 2 distinct maps. First would be static of output -> port and bit and could be hardcoded in the header of canRelay now. The second would just map canIDs to output numbers and would be stored in EEPROM and shall be able to be changed over CONFIG messages sent over CAN to the relay (this time it needs strict acceptance filter only for the node ID)

Change CanRelay to use ID mappings to ports

CanSwitch should only know it’s nodeID and send can messages for that ID to up to ID+# of inputs (already the case). Change relay logic to have an array of mappings from IDs to individual port bits according to the final schema.

CanSwitch to support faking a button switch over CAN

New message type of button press to mimic button pres on CanSwitch only. to be able to stress test the whole system by simulating sending can messages from multiple can switches to see the real power consumption and thus potential voltage drop then

CanSwitch to use RC ports for CANRX and CANTX in newer PCB

To be able to save and use all PORTB pins for inputs. Also routing would be nicer on the board thanks to this. Perhaps support even for older PCbs, but resolder the paths. Set CONFIG3H.CANMX = 0 according to datasheet. Input 7 and 8 are shared with PGC and PGD. All input ports are in the end available on the PCB, so all good.

Improve complex reply for canRelay

At the moment, canRelay replies are the same regardless the floor since the can ID is always 400. Change this so that it contains floor instead of 0 for node ID. Solves just the issue of odroid listening for complex reply in case multple complex get would be sent at the same time to all floors.

Update can data schema

Number of operations is rather small and it is a waste to use all 8 bits for that. So update to only use some bits of the data for the real switch operations (toggle on and off), use the remaining bits for firmware version, perhaps number of switches done (since we have no timer we can at least see if switches live long or get bounced every now and then), plus a flag set to 1 if there is any error registers non zero from CAN (1 bit).

CanRelay project

  • Can a dao bude taky využito novým projektem CanRelay - novej širší filtr pro všechno normal messages, ne heartbeat a ne config a jen jedno patro - čte z eeprom.
  • Dle canID pak jen přepne output pin - je úplně jedno co to je za místnost, jen prostě pro floor jedna odečte 10000000 a má číslo, toto číslo pak přepne v portech - potřebuje maximum output portů a asi radši maximum recieve bufferu
  • Floor bude novej data type, využije jenom canRelay

test all input pins fire

stress testing. wire up all input pins of all can switches together to be able to simulate all switches at once. observe the current drawn.

Low power consumption of CanSwitch

Utilize sleep modes in canSwitches - Look at datasheet how complex it would be. It may save some voltage drops across the line. Look into power mode of the transceiver too

CanRelay drops messages under load

Send complex get to a relay in infinite loop fully utilizing CAN and CanRelay is then dropping some of them, including all key presses from switches. Probably does not anticipate that load and read all registers it should, so fix it.

EEPROM read and write do not work properly

Current dao implementation has some issues, it does not store the values properly. In addition to that the logic for checking invalid values does not work either - it is always 0xFF (the invalid values read)

New CanSetup project

  • Nodes.h - enum se vsema mistnostma, správně ID pro ně - první bit je patro
  • Novej projekt CanSetup - jen zapíše eeprom dle nastavení - setupCanSwitch (kitchen - enum). SetupCanRelay(1 bit floor). Použije Nodes.h a can a dao library

Report voltage level

Enhance heartbeat and complex get messages by also reporting the voltage levels

Update relayMappings once the house lights are clear

I need to know the list of rooms and number of individual wall switches in there. Duplicate switches for the same light are supported too, but would result in different canIDs, so I need to know the full list in order to update the relay mappings for both floors. Flash new firmware to floors then, perhaps increase the counter of firmware then too

Integration testing

  • Think it over. A test first flashing a node with an ID, then testing that against other CAN? Or maybe together with CanRelay somehow? But the number of flashes is limited per each chip, so this may be tricky

QA testing of each canRelay and canSwitch

Measure current drawn by each. Test it can send CAN traffic over, check the CAN errors. Perhaps increase the transceiver timeout if errors still occur? Could have been a glitch actually.

CanRelay smarter switch

Novy model dat pro CanSwitch.

bit 7 = switch - přepne světlo (tj aktualni funkce dneska)
bit 6 = zapnutí (pouze pokud bit 7 je 0)
bit 5 = vypnutí (pouze pokud bit 7 je 0)
bit 4 = request na stav (pouze pokud bity 7 a 6 a 5 jsou 0)

0b10000000 přepne světlo jako dneska canSwitch
0b01000000 zapne světlo nezávisle na předchozím stavu
0b00100000 vypne světlo nezávisle na předchozím stavu

Navic canID 0 pro dane patro take plati to nahore (tj. bit 7 prepne vsechna svetla, bit 6 nastavi vsechna svetla na zapnuto, ...)

Navic pro canID 0 je navic bit4 request, aby CanRelay automaticky odpovedel se stavem vsech PORTA, PORTB a PORTC

Switch debounce in CanRelay

Protect against potential sporadic multiple messages for one nodeID other than floor. I.e. from light switches.

Update documentation

Latest changes with latest boards turned some of the README invalid since we are no longer mapping ports to outputs easily. Also look to see if the fact nodeID is just 7 bits was mentioned anywhere since that is no longer true either for a given floor. It now holds the full 8 bits value since it has inherited the floor in it and also simplifies the logic a bit

CanRelay is using chip with 44pins

Update code to use all PORTD and E ports too. Recheck all the pin assignments. Measure voltage again. CanRX and TX ports stay at B ports. Check MCLR too so it is not port E instead.

New project in DesignSpark

  1. One model for can relay
    1.1. no status diode, just all outputs
  2. One model for can switch - to be used by alarm system too
    2.1. 1 pin for input, 1 pin for diode status

Implement permanent data storage

Options: flash memory, EEPROM memory. Maybe flash could be used since this is really supposed to be constant (check datasheet on that again)

Cover the case of quarter a second running out of max

Even though we are talking about a theoretical case since this is unsigned long, so should be 2^32 quarters of a second, which is about 34 years:) But anyway in case anything ever goes wrong, cover the case of the quarter of a second getting to max and then move to 0 - the check of last switch press would effectively turn on the switch suppressing...

Decrease baud rate

To save from future troubles and increase stability, drop the baud rate to say 10kbps or even less. Figure out if cansend in linux supports that though

CanSwitch to suppress sending burst of CAN messages

Sometimes when the button is pressed, the input change is raised several times in a row, resulting in multiple CAN messages being sent and the target light blinking. Limit this, so that a CAN message is sent on switch press only after half a second after last switch press

Support generic operation in CanSwitch

Right now just toggle is default. So create new datatype operation, treat toggle by default, but support switch on and off too. Most Likely will only need switch off all. That way we can have one smart such in wall to switch off all lights in the house. Or even combination. If a flag is set, treat input 1 as switch off all. Then we can just hook up this wall switch to existing smart CanSwitch in the hall for example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.