Git Product home page Git Product logo

thermidity's People

Contributors

gitdode avatar sprintersb avatar

Watchers

 avatar  avatar

Forkers

sprintersb

thermidity's Issues

Try to go to sleep mode during sensor power-on settling time

Instead of

_delay_ms(100);

could just

set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_mode();

and get woken up by watchdog after 1 second. The sensors certainly don't mind to have 1s instead of 100ms to settle.

Power consumption should be 1s * ~250uA vs. 100ms * ~6mA.

To be tested & measured.

Problems with `Makefile`

Makefile

  • Option -D__AVR_ATmega328P__ should be removed. This is a built-in define, and provided by specs-atmega328p since v5. If the compiler does not work as expected without defining that macro by hand, the toolchain is broken.
  • Option -Wl,--relax bypasses the assembler and should be replaced by -mrelax. Otherwise, the assembler might compute symbol values / offsets at assembly time, but which are actually not computable at assembly time because linker relaxation might change their values.
  • thermidity.elf depends on header files like font.h, which is not described in the current Makefile. This means that when you only change some header(s) and then rerun make, it won't re-build thermidity.elf.

Use pointer-to-const when a function is not supposed to change a pointed-to object (like with String outputters)

In functions like sram::sramWriteString, display::writeString and uart::printString that get a (pointer-to) string argument, the pointed-to object should be const because these functions are not supposed to change the pointed-to object.

For example, usart::printString should have prototype

void printString (const char *data) (or void printString (const char *const data) if you wish).

Notice that it makes a difference on which side of the * the const is placed:

  • Left of the *, the const refers to the pointed-to object.
  • Right of the *, the const refers to the pointer itself, i.e. to data in the example.

In most cases, it is fine to change pointers like data, e.g. by using them to iterate over the chars in a string, whereas for output functions like above, they should still work as expected and without diagnostic in contexts like:

const char text[] = "Hallo";
printString (text);

As a aside, this applies to other qualifiers like volatile or __flash as well, and also to pointers of higher order:

In volatile int *p;, p points to a volatile object but b itself is not volatile, whereas in int * volatile p;, p itself is volatile but the pointed-to object is not, and in volatile int * volatile p;, both p and the pointed-to object are volatile.

In int **p; there are 8 = 23 possible ways to put volatile's.

Try ratiometric measurement

  • humidity sensor is ratiometric
  • use a thermistor instead of TMP36
  • no need for a reference voltage; use ATmega's internal 1.1V reference to measure battery voltage
  • neither humidity sensor nor thermistor (?) require a bypass capacitor so MCU output pin can easily switch their supply current

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.