Code Monkey home page Code Monkey logo

margay_library's People

Contributors

awickert avatar bschulz1701 avatar ericbarefoot avatar morandagny avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

margay_library's Issues

Add support for general fault condition

Allow each sensor to have a fault function which returns a category (?) of fault. This can be based on out of bounds errors, lack of sub module working on a slave, etc, but would allow for a more general fault case than simply if an I2C connection is there, and would work for non-I2C devices as well (bigger issue)

Verify/Fix SD Check

Issue:

When a hardware SD card failure occurs, a red OBFailure light is indicated, but printout reads SD: PASS, looking briefly at the code, looks as though it would never throw a true SD card failure

Potential Fix:

Reconcile difference/use of SDError vs. SDErrorTemp
Look into triggering caused at like 386 and 387 (End of Margay::SDTest in Margay.cpp

Unable to talk to ADC when Margay is running

Margay:run() does not permit the user to access the on-board (but also external) ADC. This component is needed to read analog voltages, but cannot be accessed if one is also reading data from an external I2C unit.

Fix battery voltage measurement

Battery voltage is off by a large margin due to the high input impedance of the voltage divider. Find low level work around.

Solution:

Adjusted the default voltage reference (unsure of what default state is), and set to use AREF pin, this was done with ADMUX = 0b00000000;, also sets mux to ADC0 for some time before the measurement is made, allowing the sample and hold cap to charge up beforehand.

Also set clock divider to maximum, again, allowing for the longest sampling interval for the Sample and Hold cap to charge. This was done with ADCSRA = 0b10000111;

Finally, measured VRef pin (1.8v reference) and used this to compensate for errors in 3.3v reference voltage assumption. Important, this measurement should be made after the divided battery voltage measurement, otherwise this defeats the precharge we performed.

Note: Hardware solution would be to use a lower value voltage divider, or use a unity gain buffer on the input stage of the ADC to compensate for the very high output impedance of the voltage divider

To Do:

  • Find slow sampling solution
  • Test slow sampling system
  • Make precharge command general to any analog pin, in case battery voltage divider is connected to another port.

Bundle all required libraries

Find a way to bundle all of the required libraries with the main library for version control and ease of install

  • DS3231_Logger.h
  • SdFat.h
  • MCP3421.h

Add low battery fault indicator

Add a color indicator for low battery, test at startup, maybe yellow?

  • Add low battery fault indication (light)
  • Print out battery voltage on startup
  • Print out battery % on startup
  • Make battery % relative to 50% (3.3v) being minimum value

Log button reset

Issue:

On branch Dev_v2 commit ade9e0f, when using Margay v1.0 hardware, when the log button is pressed the system resets

Potential Fix:

Most likely an interrupt vector problem, make sure the vector is setup properly for the pin

Fix Clock fault condition

Currently when no clock battery is installed, the message printed is

Clock:  PASS, BAD TIME
 FAIL

This triggers both an OBError and a TimeError, fix such that if the clock does not increment (which will correctly cause an OBError), then this invalidates a TimeError and the resurned result should simply be

Clock: FAIL

Triggering just an OBError, not a TimeError since this (while technically correct) is confusing and can give the illusion from light states that the clock is not the problem

Spelling/phrase changes needed

troubleshooting/general: line 3: "is"->"in", line 4: "unexpected results" is awkward
troubleshooting/orange: line 3: "lose"->"loose"
I'll double check again to be sure of others

Zero padding

Within this function (starting Line 319):

void Margay::InitLogFile()
{
    String FileName = "Log";
    int FileNum = 1;
    String NumString = "01";
    (FileName + "01"+ ".txt").toCharArray(FileNameC, 11);
    while(SD.exists(FileNameC)) {
      FileNum += 1;
      NumString = String(FileNum, DEC);
      (FileName + NumString + ".txt").toCharArray(FileNameC, 11);
    }
    (FileName + NumString + ".txt").toCharArray(FileNameC, 11);

    LogStr("Time [UTC], Temp OB [C], Temp RTC [C], Bat [V], " + Header); //Log concatonated header
}

Currently:
NumString = String(FileNum, DEC);
has no zero padding, though the first (01) does.

This could be fixed using:

sprintf('%02d', FileNum) (or perhaps%03d if we want to be safe)
And then finding a way to convert a char* to a String (I haven't done this before; tend to avoid String due to memory issues... thanks 1284p for making that easier).

@bschulz1701 -- sorry for raising an issue and not just fixing; don't have a Margay at home and don't want to commit unless I test!

Section placement

General comment, but placement of installation/examples/operation/etc. fits better (and is consistent with other logger pages) when placed in the Project_Margay page instead of the Library page. Either there is a reason for this that I am blind to, or it should be changed to be like the others.

Add PG detect

Add check of PG line on regulator before writing to the SD card to make sure the voltage is sufficient, if not, print one line to the file, then lockout future writes until a power cycle using a flag

Two #include <MCP3421.h>

Two includes are given in the header file. I would remove one, but I'm not sure if this is a weird way to get around include dependencies.

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.